How could the sun and moon be harmful? (Psalm 121:6) 5 The Lord watches over you— the Lord is your shade at your right hand; 6 the sun will not harm you by day, nor the moon by night.
For follow-up discussion and general commentary on the topic. Comments are sorted chronologically.
This is most probably related to the Deu 32 worldview. You can find loads of information at DRMSH.com or, check out the Naked Bible Podcast by Dr. Michael Heiser.
He is the academic editor for Logos bible software.
At a high level: The ‘sun’, ‘moon’ and ‘stars’ to the ancient Israelites were representative of the divine council of YHWH, that is, His heavenly host.
Check Deu 4, 1 Cor 15, Gen 15, Ps 82, 89 etc.
The verses are basically saying YHWH will protect us from the rebellious ones from his heavenly council (think Satan and the fallen angels).