Matthew 6:10: "'Your kingdom come, your will be done, on earth as it is in heaven.'"
Matthew 26:39: "And going a little farther he fell on his face and prayed, saying, 'My Father, if it be possible, let this cup pass from me; nevertheless, not as I will, but as you will.'"
Matthew 26:42: "Again, for the second time, he went away and prayed, 'My Father, if this cannot pass unless I drink it, your will be done.'"
1 Corinthians 10:13: "No temptation has overtaken you that is not common to man. God is faithful, and he will not let you be tempted beyond your ability, but with the temptation he will also provide the way of escape, that you may be able to endure it."
Psalm 84:12: "O LORD of hosts, blessed is the one who trusts in you!"
+++
The text is public domain:
1 The will of God is always bestAnd shall be done forever;And they who trust in Him are blest;He will forsake them never.He helps indeedIn time of need;He chastens with forbearing.They who dependOn God, their friend,Shall not be left despairing.2 God is my comfort and my trust,My hope and life abiding;And to His counsel, wise and just,I yield, in Him confiding.The very hairs,His Word declares,Upon my head He numbers.By night and dayGod is my stay;He never sleeps nor slumbers.3 Lord, this I ask, O hear my plea,Deny me not this favor:When Satan sorely troubles me,Then do not let me waver.O guard me well,My fear dispel,Fulfill Your faithful saying:All who believeBy grace receiveAn answer to their praying.4 When life's brief course on earth is runAnd I this world am leaving,Grant me to say, "Your will be done,"Your faithful Word believing.My dearest Friend,I now commendMy soul into Your keeping;From sin and hell,And death as well,By You the vict'ry reaping.
+++
The three verses from Matthew (6:10; 26:39, 42) all appear in the first two lines and are referred to again in the line "Grant me to say, 'Your will be done'" in the fourth verse.
Psalm 84:12 is rendered as "And they who trust in Him are blest" in the first verse.
1 Corinthians 10:13 seems to be the basis for the third verse.
+++
The lines "The very hairs, / His Word declares, / Upon my head He numbers" in the second verse refer to Matthew 10:30: "'But even the hairs of your head are all numbered.'"
The line "He never sleeps nor slumbers" at the end of the second verse comes from Psalm 121:4 ("Behold, he who keeps Israel will neither slumber nor sleep"), so it seems that the preceding lines ("By night and day / God is my stay") may be drawn at least partially from Psalm 121:6 ("The sun shall not strike you by day, nor the moon by night"). Incidentally, "night and day" is a merism.
The line "When life's brief course on earth is run" at the beginning of the fourth verse may allude to part of Hebrews 12:1: "let us run with endurance the race that is set before us."