Then (v 39), he shows what the Father wills; and next, why he wills it (v 40).
He says: I will not cast out those who come to me, because I have taken flesh in order to do the will of the Father: Now it is the will of him who sent me, the Father, that those who come to me I will not cast out; and so I will not cast them out. "This is the will of God, your sanctification" (1 Thes 4:3). Therefore he says that it is the will of the Father that of all that he, the Father, has given me I should lose nothing, i.e., that I should lose nothing until the time of the resurrection. At this time some wil...l be lost, the wicked; but none of those given to Christ through eternal predestination will be among them: "The way of the wicked will perish" (Ps 1:7). Those, on the other hand, who are preserved until then, will not be lost.
Now when he says, lose, we should not understand this as implying that he needs such people or that he is damaged if they perish. Rather, he says this because he desires their salvation and what is good for them, which he regards as his own good.
What John later reports Christ as saying seems to conflict with this: "None of them," that is, of those you have given me, "have been lost except the son of perdition" (below 17:12). Thus, some of those given to Christ through eternal predestination are lost. Accordingly, what he says here, that of all that he has given me I should lose nothing, is not true. We must say to this that some are lost from among those given to Christ through a present justification; but none are lost from among those given to him through eternal predestination.
Source: Commentary on John