The Prophet ﷺ said to him, "Shall I teach you words to say when you go to your bed? If you die that night, you will die upon the natural disposition of Islam, and if you wake in the morning, you will wake having earned good. Say, 'O Allah, I have submitted myself to You, turned my face to You, entrusted my affair to You, and laid my back against You, in hope of You and in fear of You. There is no refuge or escape from You except to You. I have believed in Your Book which You sent down and Your Prophet whom You sent.'"Bara said, "I said, 'And in Your Messenger whom You sent.'"He struck my chest with his hand and said, "And Your Prophet whom You sent."
حدثنا ابن أبي عمر حدثنا سفيان بن عيينة عن أبي إسحق الهمداني
أن النبي ﷺ قال له ألا أعلمك كلمات تقولها إذا أويت إلى فراشك فإن مت من ليلتك مت على الفطرة وإن أصبحت أصبحت وقد أصبت خيرا تقول اللهم إني أسلمت نفسي إليك ووجهت وجهي إليك وفوضت أمري إليك رغبة ورهبة إليك وألجأت ظهري إليك لا ملجأ ولا منجى منك إلا إليك آمنت بكتابك الذي أنزلت ونبيك الذي أرسلت قال البراء فقلت وبرسولك الذي أرسلت قال فطعن بيده في صدري ثم قال ونبيك الذي أرسلت
Agreed upon. Bukhari narrated it in "Tawhid," chapter "His saying, He sent it down with His knowledge, and the angels bear witness," hadith 7488, and Muslim, hadith 2710, from the hadith of Abu Ishaq, with this same wording. The hadith of Mansur will come at 3574. On this topic there is also a narration from Rafi bin Khadij [coming at 3395].