Abdullah bin Amr bin As reported,

The Messenger of Allah ﷺ said, "When Sulayman bin Dawud ﷺ built Bayt al-Maqdis, he asked Allah, the Mighty and Majestic, for three things. He asked Allah for judgment that would align with His judgment, and it was granted to him. He asked Allah for a kingdom that would not be fitting for anyone after him, and it was granted to him. And when he finished building the mosque, he asked Allah, the Mighty and Majestic, that whoever came to it intending nothing but prayer within it would emerge from his sins as on the day his mother bore him."

Azami 10697

Sahih

عن عبد الله بن عمرو

عن رسول الله ﷺ قال: إن سليمان ابن داود ﷺ لما بنى بيت المقدس سأل الله عزوجل خلالا ثلاثة: سأل الله عزوجل حكما يصادف حكمه فأوتيه، وسأل الله عزوجل ملكا لا ينبغي لأحد من بعده فأوتيه، وسأل عزوجل حين فرغ من بناء المسجد أن لا يأتيه أحد لا ينهزه إلا الصلاة فيه أن يخرجه من خطيئته كيوم ولدته أمه.

الأعظمي 10697صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Virtues of the lands
Chapter
Virtues of Sham, the Arabs, and the Peninsula, and reports about them
Section
Virtue of prayer in Bayt al-Maqdis
Numbering
Jami al-Kamil 10697 (2nd edition)
Azami 10697