كتاب آداب النوم
4  
The Book of the Etiquette of Sleeping, Lying and Sitting etc
(127)
Chapter: What is to be said at the time of Sleeping
(127)
باب ما يقوله عند النوم
Riyad as-Salihin 816
Hudhaifah (May Allah be pleased with him) reported:
Whenever the Prophet (ﷺ) lay down for sleep at night, he would place his (right) hand under his (right) cheek and supplicate: "Allahumma bismika amutu wa ahya [O Allah, with Your Name will I die and live (wake up)]." And when he woke up, he would supplicate: "Al-hamdu lillahil-ladhi ahyana ba'da ma amatana, wa ilaihin-nushur (All praise is due to Allah, Who has brought us back to life after He has caused us to die, and to Him is the return)."

[Al-Bukhari].

وعن حذيفة رضى الله عنه قال‏:‏كان النبي صلى الله عليه وسلم إذا أخذ مضجعه من الليل وضع يده تحت خده، ثم يقول‏:‏ ‏"‏اللهم باسمك أموت وأحيا‏"‏ وإذا استيقظ قال‏:‏ ‏"‏الحمد لله الذي أحيانا بعد ما أماتنا وإليه النشور‏"‏ ‏(‏‏(‏رواه البخاري‏)‏‏)‏.‏
Reference : Riyad as-Salihin 816
In-book reference : Book 4, Hadith 4