סימן צז סעיף יד
אִם הַלְּבָנָה זוֹרַחַת בִּתְחִלַּת הַלַּיְלָה קֹדֶם שֶׁהִתְחִילוּ לְהִתְפַּלֵּל מַעֲרִיב, אִם יֵשׁ עוֹד זְמָן אֵיזֶה לֵילוֹת לְקַדְּשָׁהּ, מִתְפַּלְּלִין תְּחִלָּה מַעֲרִיב, וְאַחַר כָּךְ מְקַדְּשִׁין אוֹתָהּ, מִשּׁוּם דְּתָדִיר וְשֶׁאֵינוֹ תָדִיר תָּדִּיר קוֹדֵם, וְעוֹד דִּקְרִיאַת שְׁמַע הֲוֵי דְּאוֹרָיְתָא. אֲבָל אִם אֵין עוֹד זְמָן רַק שְׁנַיִם אוֹ שְׁלשָׁה לֵילוֹת, בִּזְמַן קָצָר כָּזֶה יֵשׁ לָחוּשׁ שֶׁמָּא תִּתְכַּסֶּה בֶּעָבִים. וּבְעֵת הַגְּשָׁמִים, גַּם כְּשֶׁיֵּשׁ עוֹד זְמַן אַרְבָּעָה לֵילוֹת, יֵשׁ לָחוּשׁ לְכִסּוּי עֲנָנִים, וְיֵשׁ לְהַקְדִּים קִדּוּשׁ לְבָנָה. וְאִם נִרְאֲתָה הַלְבָנָה בְּעֵת שֶׁאוֹמְרִים קְרִיאַת שְׁמַע וּבִרְכוֹתֶיהָ, אִם הַזְּמָן מְצֻמְצָם כָּל כָּךְ שֶׁבְּעוֹד שֶׁיִּגְמְרוּ שְׁמֹנֶה עֶשְׂרֵה יַעֲבֹר זְמַן קִדּוּשָׁהּ, יְכוֹלִין לְהַפְסִיק אֲפִלּוּ בְּאֶמְצַע בִּרְכוֹת קְרִיאַת שְׁמַע אוֹ אוֹ בְּאֶמְצַע קְרִיאַת שְׁמַע לְקַדֵּשׁ אוֹתָהּ. אַךְ אִם אֶפְשָׁר, יִגְמְרוּ אֶת הַפֶּרֶק, לְקַדְּשָׁהּ בֵּין הַפְּרָקִים (עַיֵּן לעיל סִימָן טז סָעִיף א) (נוב"ק סִימָן מא).
If the moon is visible at the beginning of the night, before you began the Maariv prayer, and there is still time, [i.e., there are still] a few more nights in which to sanctify it, you should say the Maariv prayer first, and then sanctify the moon, because a mitzvah that is constant takes precedence over one that is only periodic,30Maseches Zevachim 90a. and also the reading of the Shemah is a Biblical precept.31And thus it has precedence over sanctifying the moon which is not Biblically ordained. If, however, there remains only two or three nights [to the end of the period], since the time is short, it may happen that the moon will be covered by clouds. And in the rainy season even if there remain yet four nights [to the end of the period], it may happen that it will become covered by clouds, and therefore you should first sanctify the moon (and then say Maariv). If the moon becomes visible at the time you are saying Kerias Shema and its berachos, and the time is so limited that before you complete Shemoneh Esrei the time of sanctification will have passed, you may interrupt even in the middle of the berachos of Kerias Shema, or in the middle of Kerias Shema in order to sanctify it. But if possible, you should complete the section [you are reading,32See Kitzur Shulchan Aruch Chapter 16.] and sanctify the moon between the sections.33You may only say the (berachah) sanctifying the moon, but not the verses we are accustomed to say after the berachah. [Lechem Haponim (author of the Kitzur Shulchan Aruch)]
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)