The Messenger of Allah ﷺ said, "Do not undertake a journey to visit any mosque except three, the Sacred Mosque, my mosque, and the Aqsa Mosque."
حدثنا يزيد أخبرنا محمد عن أبي سلمة
قال رسول الله ﷺ لا تشد الرحال إلا إلى المسجد الحرام ومسجدي والمسجد الأقصى
Its isnad is sahih. Bukhari related it, 2/76, in the chapter on the merit of prayer in the masjid of Makkah and Madinah, as did Muslim, 2/1014, no. 1397, Abu Dawud, 2033, Tirmidhi, 336, Nasai, 2/73, and Ibn Majah, 1409.