Ibn Khuzaymah recorded it with this very wording in his Ṣaḥīḥ, as quoted in al-Targhīb, and the ḥadith in full states:
“One prayer in the Mosque of Madinah is better than 1,000 prayers in any other mosque, and one prayer in the Mosque of Jerusalem is better than 500 prayers in any other mosque.”
Al-Ṭabarānī likewise narrated it in al-Kabīr with a similar wording. Al-Haythamī comments: “Its transmitters are trustworthy, though a few have been critiqued; the ḥadith is ḥasan.” Al-Munḏirī adds: “Al-Bazzār also transmitted it and said, ‘Its chain is ḥasan.’ Such were his words.”
This hints that the matter is not exactly as al-Bazzār maintained. Al-Ḥāfiẓ reproduced the statement in Fatḥ al-Bārī and endorsed it, since he offered no further remark—Allah knows best.
The ḥadith has supporting reports, among them the one from ʿAbd Allāh ibn al-Zubayr, traced back to the Prophet in the form:
“One prayer in this mosque of mine is better than 1,000 prayers in any other mosque except the Sacred Mosque, and one prayer in the Sacred Mosque is better than 100 prayers in this mosque.”
Al-Ṭaḥāwī and Aḥmad transmitted it through the path of Ḥammād ibn Zayd, who said: Ḥabīb al-Muʿallim related it to us from ʿAṭāʾ—from him.
This chain is sound according to the criteria of the Six Books. Ibn Ḥibbān judged it authentic, and for that reason both he and Ibn Khuzaymah included it in their Ṣaḥīḥ collections, as cited in al-Targhīb. He said: