Isaiah 9:2: "The people who walked in darkness have seen a great light; those who dwelt in a land of deep darkness, on them has light shined."
Isaiah 9:6-7: "6 For to us a child is born, to us a son is given; and the government shall be upon his shoulder, and his name shall be called Wonderful Counselor, Mighty God, Everlasting Father, Prince of Peace. 7 Of the increase of his government and of peace there will be no end, on the throne of David and over his kingdom, to establish it and to uphold it with justice and with righteousness from this time forth and forevermore. The zeal of the LORD of hosts will do this."
Matthew 4:16: "'the people dwelling in darkness have seen a great light, and for those dwelling in the region and shadow of death, on them a light has dawned.'"
+++
The text is public domain:
The people that in darkness sat
A glorious light have seen;
The light has shined on them who long
In shades of death have been,
In shades of death have been.
To hail Thee, Sun of Righteousness,
The gath'ring nations come;
They joy as when the reapers bear
Their harvest treasures home,
Their harvest treasures home.
To us a Child of hope is born,
To us a Son is giv'n,
And on His shoulder ever rests
All pow'r in earth and heav'n,
All pow'r in earth and heav'n.
His name shall be the Prince of Peace,
The Everlasting Lord,
The Wonderful, the Counselor,
The God by all adored,
The God by all adored.
His righteous government and pow'r
Shall over all extend;
On judgment and on justice based,
His reign shall have no end,
His reign shall have no end.
Lord Jesus, reign in us, we pray,
And make us Thine alone,
Who with the Father ever art
And Holy Spirit, one,
And Holy Spirit, one.
+++
The Biblical sources here are very straightforward. Isaiah 9:2 (quoted in Matthew 4:16) is the text for the first verse, and Isaiah 9:6-7 is the text for verses three through five.
The phrase "Sun of Righteousness" in the second verse comes from Malachi 4:2: "But for you who fear my name, the sun of righteousness shall rise with healing in its wings. You shall go out leaping like calves from the stall." I think the second verse also draws from Isaiah 60. Like "darkness" and "deep darkness" in Isaiah 9:2, Isaiah 60 has "darkness" in parallel with "thick darkness" (60:2) and also uses imagery of light. In the hymn, the line "The gath'ring nations come" seems to come specifically from Isaiah 60:3: "And nations shall come to your light, and kings to the brightness of your rising."