(Genesis 1:17) "And God set them in the firmament of the heaven." The luminaries were given as a gift to the world; and so the Torah, "and He gave to Moses"; and so the rains, "and I will give your rains" (Leviticus 26:4); and so peace, "and I will give peace" (Leviticus 26:6); and so salvation, as it is written, "and You gave me the shield of Your salvation" (2 Samuel 22:36). Where are the sun and the moon set? In the second firmament, as it is said, "And God set them in the firmament of the heaven." The verse is explicit, and the Men of the Great Assembly explained it: "You made the heavens, the heaven of heavens, and all their host" (Nehemiah 9:6). Where is all their host placed? In the second firmament, which is above the heavens. It is written, "and the heavens declare His righteousness" (Psalms 50:6) - in the time to come the heavens will tell of the righteousness which the Holy One, blessed be He, did with His world, that He did not set them in the first firmament; for had He done so, no creature could endure because of the fire of the day. (Genesis 1:18) "And to rule by day and by night." If this concerns the luminaries, was it not already said, "the greater light for the dominion of the day"? Rather, these are the righteous, who rule over that which was created to give light by day and by night. This is what is written, "And the sun stood still, and the moon stayed... is this not written in the Book of Jashar?" (Joshua 10:13). It is derived from here: "and to rule by day and by night."
The Lights Given as a Gift and the Righteous Who Rule Them
Yalkut Shimoni on Torah 10:1
(בראשית א יז) וַיִּתֵּן אֹתָם אֱלֹהִים בִּרְקִיעַ הַשָּׁמָיִם, נִתְּנוּ הַמְּאוֹרוֹת מַתָּנָה לָעוֹלָם וְכֵן הַתּוֹרָה, "וַיִּתֵּן אֶל משֶׁה", וְכֵן הַגְּשָׁמִים (ויקרא כו, ד) "וְנָתַתִּי גִשְׁמֵיכֶם", וְכֵן הַשָּׁלוֹם (שם, ו) "וְנָתַתִּי שָׁלוֹם", וְכֵן הַיְשׁוּעָה, כְּדִּכְתִיב "וַתִּתֶּן לִי מָגֵן יִשְׁעֶךָ". הֵיכָן חַמָּה וּלְבָנָה בְּרָקִיעַ שֵׁנִי, שֶׁנֶּאֱמַר וַיִּתֵּן אֹתָם אֱלֹהִים בִּרְקִיעַ הַשָּׁמַיִם מִקְרָא מָלֵא הוּא וְאַנְשֵׁי כְּנֶסֶת הַגְּדוֹלָה פֵּרְשׁוּהוּ, (נחמיה ט, ו) "אַתָּה עָשִיתָ אֶת הַשָּׁמַיִם שְׁמֵי הַשָּׁמַיִם וְכָל צְבָאָם" הֵיכָן הֵם כָּל צְבָאָם נְתוּנִין, בָּרָקִיעַ הַשֵּׁנִי שֶׁהוּא לְמַעְלָה מִן הַשָּׁמַיִם. כְּתִיב ["וְ]יַגִּידוּ שָׁמַיִם צִדְקוֹ", לֶעָתִיד לָבֹא שָׁמַיִם מְתַנִים צְדָקָה שֶׁעָשָה הַקָּדוֹשׁ בָּרוּךְ הוּא עִם עוֹלָמוֹ שֶׁלֹּא נְתָנָהּ בָּרָקִיעַ הָרִאשׁוֹן, שֶׁאִלּוּ כֵן לֹא הָיְתָה בְּרִיָּה יְכוֹלָה לַעֲמֹד מִפְּנֵי אִשּׁוֹ שֶׁל יוֹם. (בראשית א יח) וְלִמְשֹׁל בַּיּוֹם וּבַלַּיְלָה, אִם לְעִנְיַן הַמְּאוֹרוֹת הֲלֹא כְּבָר נֶאֱמַר אֶת הַמָּאוֹר הַגָּדֹל לְמֶמְשֶׁלֶת הַיּוֹם וְגוֹ'. אֶלָּא אֵלּוּ הַצַּדִּיקִים שֶׁהֵם שׁוֹלְטִים בְּמָה שֶׁנִּבְרָא לְהָאִיר בַּיּוֹם וּבַלַּיְלָה הֲדָא הוּא דִּכְתִיב (יהושע י, יג) "וַיִּדֹּם הַשֶּׁמֶשׁ וְיָרֵחַ עָמָד הֲלֹא הִיא כְתוּבָה עַל סֵפֶר הַיָּשָׁר". מַיְּתֵי לֵיהּ מֵהָכָא, וְלִמְשֹׁל בַּיּוֹם וּבַלַּיְלָה.