סימן ע סעיף ג
מִי שֶׁבָּא לְבֵית הַכְּנֶסֶת לִתְפִלַּת עַרְבִית וּמָצָא שֶׁהַצִּבּוּר עוֹמְדִין לְהִתְפַּלֵּל שְׁמֹנֶה עֶשְׂרֵה, אֲפִלּוּ עֲדַיִן אֵינוֹ לַיְלָה, אֶלָּא מִפְּלַג הַמִּנְחָה וּלְמַעְלָה, מִתְפַּלֵּל עִמָּהֶם שְׁמֹנֶה עֶשְׂרֵה, וְאַחַר כָּךְ כְּשֶׁיִּהְיֶה לַיְלָה יֹאמַר קְּרִיאַת שְׁמַע עִם הַבְּרָכוֹת. וְאִם הַצִּבּוּר עוֹמְדִין בְּאֶמְצַע קְרִיאַת שְׁמַע וּבִרְכוֹתֶיהָ, וְיֵשׁ לוֹ שָׁהוּת לוֹמַר קֹדֶם שֶׁיַּגִּיעוּ לִתְפִלַּת שְׁמֹנֶה עֶשְׂרֵה, קְרִיאַת שְׁמַע עִם הַבְּרָכוֹת עַד שׁוֹמֵר עַמּוֹ יִשְֹרָאֵל לָעַד יַעֲשֶׂה כן, וִידַלֵּג בָּרוּךְ ה' לְעוֹלָם וְכוּ', וְאֵינוֹ צָרִיךְ לְאָמְרוֹ אַחַר כָּךְ לְאַחַר הַתְּפִלָּה (מהריעב"ץ), וְאִם הוּא לֹא הִתְפַּלֵּל עֲדַיִן מִנְחָה, יִתְפַּלֵּל תְּפִלַּת שְׁמֹנֶה עֶשְׂרֵה שֶל מִנְחָה, בְּשָׁעָה שֶׁהַצִּבּוּר אוֹמְרִים קְרִיאַת שְׁמַע עִם הַבְּרָכוֹת, וְיִשְׁהֶה מְעַט לְכָל הַפָּחוֹת כְּדֵי הִלּוּךְ דּ' אַמּוֹת, וְיִתְפַּלֵּל אַחַר כָּךְ שְׁמֹנֶה עֶשְׂרֵה עִם הַצִּבּוּר לְמַעֲרִיב. וְאַחַר כָּךְ כְּשֶׁיִּהְיֶה לַיְלָה, יֹאמַר קְרִיאַת שְׁמַע עִם הַבְּרָכוֹת.
If you arrive at the synagogue for the Maariv prayer, and find the congregation about to begin the Shemoneh Esrei, even if it is before nightfall but after pelag haminchah, you should pray Shemoneh Esrei, along with them, and afterwards—after nightfall, recite Kerias Shema with the berachos. If the congregation is holding in mid-Kerias Shema and its berachos, and you have sufficient time to recite Kerias Shema and [its] berachos until Shomeir amo Yisrael la'ad, before they reach Shemoneh Esrei, you should do so and omit Baruch Hashem le'olam etc. and you are not required to say it after the prayer.9Baruch Hashem le’olam was instituted so that those who arrive late be given the opportunity to complete their prayers together with everyone (Tosafos). It is, therefore, not necessary to make it up after Maariv. If you have not yet prayed Minchah,10And you arrive when the congregation is in mid-Kerias shema and its berachos. you should pray the Shemoneh Esrei prayer of Minchah while the congregation is reciting Kerias Shema with the berachos, and wait,11Between Shemoneh Esrei. at least the time required to walk four amos and afterward pray the Maariv Shemoneh Esrei with the congregation. Afterwards—after nightfall you should recite Kerias Shema with the berachos.
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)