Sahih Bukhari | Volume 8 | Hadith Number 325

Narrated by Al-Bara bin 'Azib
That the Prophet advised a man, saying, "If you intend to lie down (i.e. go to bed), say, 'Allahumma aslamtu nafsi ilaika wa fauwadtu Amri ilaika, wa wajjahtu wajhi ilaika wa alja'tu zahri ilaika, reghbatan wa rahbatan ilaika. La malja'a wa la manja minka illa ilaika. Amantu bikitabikal-ladhi anzalta; wa nabiyyikalladhi arsalta.' And if you should die then (after reciting this before going to bed) you will die on the religion of Islam."