Narrated Abu Huraira:
“The Prophet said, “Last night a big demon (ifreet) 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.”
Prophets shared a special kind of brotherhood. They respected and helped each other even while living decades away from each other.
And (remember) when Allah took the Covenant of the prophets, saying: “Take whatever I gave you from the Book and Hikmah (understanding of the Laws of Allah), and afterwards there will come to you a Messenger (Muhammad صلى الله عليه وسلم) confirming what is with you; you must, then, believe in him and help him.” Allah said: “Do you agree (to it) and will you take up My Covenant (which I conclude with you)?” They said: “We agree.” He said: “Then bear witness; and I am with you among the witnesses (for this).” [Aal-Imran: 83]
Because of this respect for his brother Sulaiman (AS) and the dua he had made, Muhammad (SAW) let that demon go. Otherwise we might have had an interesting story to tell about that demon today.
Also, take note that it is not only Shaytan that interrupts your prayer. Iblees has forces among the jinn and men as well who aid him in his cause. Evil among the jinns and humans disturb you during your Salah and de-track you from the Straight Path. Have you taken your precautions? (Hint: understand the meaning of Surah an-Naas.)