The Prophet ﷺ said, "Do not set out on a journey except to three mosques, the Sacred Mosque, the Mosque of the Messenger ﷺ, and the Aqsa Mosque."
عن النبي ﷺ قال: لا تشد الرحال إلا إلى ثلاثة مساجد: المسجد الحرام، ومسجد الرسول ﷺ، ومسجد الأقصى.
Bukhari narrated it in the Book of the Merit of Prayer in the Masjid of Makkah and Madinah (1189), and Muslim in the Book of Hajj (1397), both from the hadith of Sufyan bin Uyayna, from Zuhri, from Saeed bin Musayab, from Abu Hurairah, as mentioned. The wording is that of Bukhari.