Sayyiduna Abu Hurairah (may Allah be pleased with him) narrates that the Messenger of Allah (peace and blessings be upon him) said: "Last night, a great jinn tried to distract me so that he could break my prayer, but Allah gave me control over him, so I pushed him away forcefully. I intended to catch him and tie him to one of the pillars of the mosque so that you all could see him in the morning." The Prophet (peace and blessings be upon him) said: "Then I remembered the supplication of my brother Sulaiman (peace be upon him): 'My Lord! Forgive me and grant me a kingdom such as shall not belong to anyone after me.' So Allah sent him back in disgrace."
Hadith Referenceمسند اسحاق بن راهويه / كتاب الصلوٰة / 135
Hadith Takhrij«بخاري ، كتاب العمل فى الصلاة ، باب مايجوز من العمل فى الصلاة ، رقم : 1210 . مسلم ، كتاب المساجد ، باب جواز لعن الشيطان الخ ، رقم : 541 . مسند احمد : 298/2»
From another chain of narration, a similar hadith is narrated from the Messenger of Allah, peace and blessings be upon him. And in place of «يفتك», a similar word is mentioned.
Hadith Referenceمسند اسحاق بن راهويه / كتاب الصلوٰة / 136