Psalm 23: "1 The LORD is my shepherd; I shall not want. 2 He makes me lie down in green pastures. He leads me beside still waters. 3 He restores my soul. He leads me in paths of righteousness for his name's sake.
"4 Even though I walk through the valley of the shadow of death, I will fear no evil, for you are with me; your rod and your staff, they comfort me.
"5 You prepare a table before me in the presence of my enemies; you anoint my head with oil; my cup overflows. 6 Surely goodness and mercy shall follow me all the days of my life, and I shall dwell in the house of the LORD forever."
John 10:11: "'I am the good shepherd. The good shepherd lays down his life for the sheep.'"
Luke 15:4-7: "4 'What man of you, having a hundred sheep, if he has lost one of them, does not leave the ninety-nine in the open country, and go after the one that is lost, until he finds it? 5 And when he has found it, he lays it on his shoulders, rejoicing. 6 And when he comes home, he calls together his friends and his neighbors, saying to them, "Rejoice with me, for I have found my sheep that was lost." 7 Just so, I tell you, there will be more joy in heaven over one sinner who repents than over ninety-nine righteous persons who need no repentance.'"
Revelation 7:17: "'For the Lamb in the midst of the throne will be their shepherd, and he will guide them to springs of living water, and God will wipe away every tear from their eyes.'"
+++
The text is public domain:
1 The King of love my shepherd is,Whose goodness faileth never;I nothing lack if I am HisAnd He is mine forever.2 Where streams of living water flow,My ransomed soul He leadethAnd, where the verdant pastures grow,With food celestial feedeth.3 Perverse and foolish oft I strayed,But yet in love He sought meAnd on His shoulder gently laidAnd home rejoicing brought me.4 In death's dark vale I fear no illWith Thee, dear Lord, beside me,Thy rod and staff my comfort still,Thy cross before to guide me.5 Thou spreadst a table in my sight;Thine unction grace bestoweth;And, oh, what transport of delightFrom Thy pure chalice floweth!6 And so through all the length of daysThy goodness faileth never;Good Shepherd, may I sing Thy praiseWithin Thy house forever!
+++
Psalm 23 is the main source for the hymn text, and parts of the hymn are just paraphrases of the Psalm. The lines "The King of love my shepherd is... I nothing lack if I am His" in the hymn's first verse come from Psalm 23:1. The hymn's second verse comes from Psalm 23:2-3, but it also incorporates the "living water" from Revelation 7:17. The hymn's fourth, fifth, and sixth verses come from the same numbered verses in Psalm 23, and the sixth verse also includes the title "Good Shepherd" from John 10:11.
The passage from Luke 15 appears in the hymn's third verse.