Sayyiduna Abdullah bin Amr (may Allah be pleased with them both) said that when the Messenger of Allah (peace and blessings be upon him) intended to sleep, he would say: "O Allah, Originator of the heavens and the earth, Knower of the unseen and the seen, Lord of everything and its God, I bear witness that there is no god but You, You are alone, You have no partner, and that Muhammad (peace and blessings be upon him) is Your servant and Your Messenger, and the angels bear witness to it. O Allah, I seek refuge in You from Satan and his polytheism, and I seek refuge in You from bringing a sin upon myself or passing it on to a Muslim."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 13691