Abu Hurairah reported,

The Messenger of Allah ﷺ said, "An ifrit from the jinn came at me last night trying to break my prayer, but Allah gave me power over him and I seized him by the throat. I was about to tie him to one of the pillars of the mosque so that you could all look at him in the morning, but then I remembered the words of my brother Sulayman, 'He said, My Lord, forgive me and grant me a kingdom such as shall not belong to anyone after me' [Sad 38:35], so Allah turned him back humiliated."

Azami 13180

Sahih

عن أبي هريرة قال

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

الأعظمي 13180صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Tafsir of Surah Sad
Section
His saying, "My Lord, forgive me and my brother and admit us into Your mercy, for You are the most merciful of the merciful. Indeed, those who took the calf, anger from their Lord will reach them"
Numbering
Jami al-Kamil 13180 (2nd edition)
Azami 13180