Jesus prayed this prayer sometime after the Last Supper and just before He went out to the Garden of Gethsemane to pray and to wait for His betrayer (Judas) to arrive.
The prayer (written below) is in three parts: for Himself, for His disciples, and for all believers who would form the church. The order here I think is important, as it seems to give us a pattern to follow—that prayers should be first for ourselves, then for those who are closest to us (our disciples), then for all others.
The prayer for Himself (v. 5) was that God would glorify Him together with Himself with the glory He had with Him before the world began. Thus, in the words of Homer Kent Jr., “[Jesus] was asking for the resumption of the full glories which he had laid aside,”
Jesus asked three things for His disciples. First, He prayed that God would keep them in His name (or keep them in His will) so that they would be unified together just as the Father and the Son were (v. 12). Second, He prayed that they would be kept (or preserved) from the evil one (v. 15). And third, He prayed that they would be sanctified (purified and made holy for the ministry He had called them to) in God’s truth—the truth of His Word (v. 17).
His prayers for the church were also in triplicate. First, He prayed that they (we) might be unified together with each other as the Father is with the Son (v. 21). Then He prayed that they (we) may be one in the Father and the Son, so that the world may believe (v. 21). Last, He prayed that they (we) may be with Him to behold His glory (v. 24) and to forever enjoy His love (v. 26).
These things Jesus spoke; and lifting up His eyes to heaven, He said, “Father, the hour has come; glorify Thy Son, that the Son may glorify Thee, 2 even as Thou gavest Him authority over all mankind, that to all whom Thou hast given Him, He may give eternal life. 3 “And this is eternal life, that they may know Thee, the only true God, and Jesus Christ whom Thou hast sent. 4 “I glorified Thee on the earth, having accomplished the work which Thou hast given Me to do. 5 “And now, glorify Thou Me together with Thyself, Father, with the glory which I had with Thee before the world was. 6 “I manifested Thy name to the men whom Thou gavest Me out of the world; Thine they were, and Thou gavest them to Me, and they have kept Thy word. 7 “Now they have come to know that everything Thou hast given Me is from Thee; 8 for the words which Thou gavest Me I have given to them; and they received them, and truly understood that I came forth from Thee, and they believed that Thou didst send Me. 9 “I ask on their behalf; I do not ask on behalf of the world, but of those whom Thou hast given Me; for they are Thine; 10 and all things that are Mine are Thine, and Thine are Mine; and I have been glorified in them. 11 “And I am no more in the world; and yet they themselves are in the world, and I come to Thee. Holy Father, keep them in Thy name, the name which Thou hast given Me, that they may be one, even as We are. 12 “While I was with them, I was keeping them in Thy name which Thou hast given Me; and I guarded them, and not one of them perished but the son of perdition, that the Scripture might be fulfilled. 13 “But now I come to Thee; and these things I speak in the world, that they may have My joy made full in themselves. 14 “I have given them Thy word; and the world has hated them, because they are not of the world, even as I am not of the world. 15 “I do not ask Thee to take them out of the world, but to keep them from the evil one. 16 “They are not of the world, even as I am not of the world. 17 “Sanctify them in the truth; Thy word is truth. 18 “As Thou didst send Me into the world, I also have sent them into the world. 19 “And for their sakes I sanctify Myself, that they themselves also may be sanctified in truth. 20 “I do not ask in behalf of these alone, but for those also who believe in Me through their word; 21 that they may all be one; even as Thou, Father, art in Me, and I in Thee, that they also may be in Us; that the world may believe that Thou didst send Me. 22 “And the glory which Thou hast given Me I have given to them; that they may be one, just as We are one; 23 I in them, and Thou in Me, that they may be perfected in unity, that the world may know that Thou didst send Me, and didst love them, even as Thou didst love Me. 24 “Father, I desire that they also, whom Thou hast given Me, be with Me where I am, in order that they may behold My glory, which Thou hast given Me; for Thou didst love Me before the foundation of the world. 25 “O righteous Father, although the world has not known Thee, yet I have known Thee; and these have known that Thou didst send Me; 26 and I have made Thy name known to them, and will make it known; that the love wherewith Thou didst love Me may be in them, and I in them. “