كتاب الذكر والدعاء والتوبة والاستغفار
48
The Book Pertaining to the Remembrance of Allah, Supplication, Repentance and Seeking Forgiveness
(17)
Chapter: Supplication When Going To Sleep
(17)
باب مَا يَقُولُ عِنْدَ النَّوْمِ وَأَخْذِ الْمَضْجَعِ

This hadith has been transmitted on the authority of al-Bara' b. 'Azib that Allah's Messenger (ﷺ) said to a person:

O, so and so, as you go to your bed; the rest of the hadith is the same but with this variation of wording that he said:" Thine Apostle whom Thou sent." If you die that night you would die on Fitra and if you get up in the morning you would get up with a bliss.
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، أَخْبَرَنَا أَبُو الأَحْوَصِ، عَنْ أَبِي إِسْحَاقَ، عَنِ الْبَرَاءِ بْنِ، عَازِبٍ قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم لِرَجُلٍ ‏"‏ يَا فُلاَنُ إِذَا أَوَيْتَ إِلَى فِرَاشِكَ ‏"‏ ‏.‏ بِمِثْلِ حَدِيثِ عَمْرِو بْنِ مُرَّةَ غَيْرَ أَنَّهُ قَالَ ‏"‏ وَبِنَبِيِّكَ الَّذِي أَرْسَلْتَ ‏.‏ فَإِنْ مُتَّ مِنْ لَيْلَتِكَ مُتَّ عَلَى الْفِطْرَةِ وَإِنْ أَصْبَحْتَ أَصَبْتَ خَيْرًا ‏"‏ ‏.‏
Reference : Sahih Muslim 2710 d
In-book reference : Book 48, Hadith 78
USC-MSA web (English) reference : Book 35, Hadith 6547
  (deprecated numbering scheme)