Bara bin Azib reported,

The Messenger of Allah ﷺ said, "When you go to your bed, perform ablution as you would for prayer, then lie down on your right side and say, 'O Allah, I submit my face to You, entrust my affair to You, and rely on You with hope and fear of You. There is no refuge or escape from You except to You. I believe in Your Book which You revealed and in Your Prophet whom You sent.' Make these the last words you speak, for if you die that night, you will die upon the natural disposition of faith."The narrator said, "I repeated them back to memorize them, and I said, '...and in Your Messenger whom You sent.'"He said, "Say, 'and in Your Prophet whom You sent.'"

Muslim 6882

Sahih

حدثنا عثمان بن أبي شيبة وإسحق بن إبراهيم واللفظ لعثمان قال إسحق أخبرنا و قال عثمان حدثنا جرير عن منصور عن سعد بن عبيدة

حدثني البراء بن عازب

أن رسول الله ﷺ قال إذا أخذت مضجعك فتوضأ وضوءك للصلاة ثم اضطجع على شقك الأيمن ثم قل اللهم إني أسلمت وجهي إليك وفوضت أمري إليك وألجأت ظهري إليك رغبة ورهبة إليك لا ملجأ ولا منجا منك إلا إليك آمنت بكتابك الذي أنزلت وبنبيك الذي أرسلت واجعلهن من آخر كلامك فإن مت من ليلتك مت وأنت على الفطرة قال فرددتهن لأستذكرهن فقلت آمنت برسولك الذي أرسلت قال قل آمنت بنبيك الذي أرسلت

مسلم 6882صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Remembrance, supplication, Tawba, and seeking forgiveness
Chapter
What to say when sleeping and lying down
Numbering
Darussalam 6882
Muslim 6882