Siman 379
Presented here for study, not as a practical ruling. The Shulchan Aruch rules by Sephardi custom, the Rema's glosses by Ashkenazi custom, and the Kitzur follows Ashkenazi custom. For a practical question, ask your rabbi.
א ב' חֲצֵרוֹת וְג' בָּתִּים בֵּינֵיהֶם פְּתוּחִים זֶה לָזֶה וְרוֹצִים לְעָרֵב יַחַד, חָצֵר זֶה בָּא דֶּרֶךְ בַּיִת שֶׁאֶצְלוֹ וְנוֹתֵן עֵרוּבוֹ בַּבַּיִת שֶׁבָּאֶמְצַע, וְכֵן עוֹשֶׂה הַשְּׁנִיָּה, וּמֻתָּרִים בִּשְׁלָשְׁתָּן; שֶׁכָּל בַּיִת שֶׁאֵצֶל הֶחָצֵר חָשׁוּב לוֹ כְּבֵית שַׁעַר וְאֵינוֹ צָרִיךְ לִתֵּן פַּת, וְהָאֶמְצָעִי הוּא בַּיִת שֶׁמַּנִּיחִין בּוֹ עֵרוּב וְאֵינוֹ צָרִיךְ לִתֵּן פַּת.
1 Laws of courtyards and houses between them. Contains 2 sections Two courtyards with three houses between them opening into one another, wishing to make a joint eruv — one courtyard comes through the house adjacent to it and places its eruv in the middle house, and the second courtyard does likewise. They are then permitted in all three, since each house adjacent to a courtyard counts as a gatehouse for it and need not contribute bread, and the middle house is the house in which the eruv is placed and also need not contribute bread.
ב שְׁתֵּי חֲצֵרוֹת וּשְׁנֵי בָּתִּים בֵּינֵיהֶם וְלֹא עֵרְבוּ יַחַד אֶלָּא כָּל אַחַת לְעַצְמָהּ, וּבָא (בֶּן) חָצֵר זֶה דֶּרֶךְ בַּיִת שֶׁאֶצְלוֹ וְהִנִּיחַ עֵרוּבוֹ בַּבַּיִת שֶׁאֵצֶל הַשֵּׁנִי, וְכֵן עָשָׂה הַשֵּׁנִי שֶׁגַּם הוּא הִנִּיחַ עֵרוּבוֹ בַּבַּיִת הַסָמוּךְ לֶחָצֵר הָאַחֶרֶת, לֹא קָנוּ עֵרוּב; שֶׁכָּל אֶחָד הִנִּיחַ עֵרוּב בְּבֵית שַׁעַר שֶׁל חָצֵר אַחֶרֶת.
2 Two courtyards with two houses between them, where they did not make a joint eruv but each made its own eruv separately — and one came from his courtyard through the house adjacent to it and placed his eruv in the house adjacent to the other courtyard, and the other did likewise, also placing his eruv in the house adjacent to the first courtyard — they have not acquired an eruv, since each one placed their eruv in the gatehouse of the other courtyard.