"The Prophet ﷺ said, "Last night a big demon (afreet) from the Jinns came to me and wanted to interrupt my prayers (or said something similar) but Allah enabled me to overpower him. I wanted to fasten him to one of the pillars of the mosque so that all of you could See him in the morning but I remembered the statement of my brother Solomon (as stated in Quran): My Lord! Forgive me and bestow on me a kingdom such as shall not belong to anybody after me (38.35)." The sub narrator Rauh said, "He (the demon) was dismissed humiliated." (Using translation from Bukhārī 461)
عَنِ النَّبِيِّ ﷺ قَالَ إِنَّ عِفْرِيتًا مِنَ الْجِنِّ تَفَلَّتَ عَلَيَّ الْبَارِحَةَ لِيَقْطَعَ عَلَيَّ الصَّلَاةَ فَأَمْكَنَنِي اللهُ مِنْهُ فَذَرَعْتُهُ وَأَرَدْتُ أَنْ أَرْبِطَهُ إِلَى جَنْبِ سَارِيَةٍ مِنْ سَوَارِي الْمَسْجِدِ حَتَّى تُصْبِحُوا فَتَنْظُرُوا إِلَيْهِ كُلُّكُمْ أَجْمَعُونَ قَالَ فَذَكَرْتُ دَعْوَةَ أَخِي سُلَيْمَانَ رَبِّ هَبْ لِي مُلْكًا لَا يَنْبَغِي لِأَحَدٍ مِنْ بَعْدِي قَالَ فَرَدَّهُ خَاسِئًا