Hudhaifa said that when the Prophet lay down on his bed at night he placed his hand under his cheek, and would then say, "O God, in Thy name I die and live." When he awoke he said, "Praise be to God who has given us life after causing us to die,* and to whom we shall be resurrected."
*Behind this phrase probably lies the idea expressed in Qur’an, xxxix, 42 which says, "It is God who takes the souls at the time of their death, and those which do not die during their sleep."
Bukhari transmitted it, Muslim transmitting from al-Bara’.
Narrated ‘Abdallah told that when evening came God’s messenger would say, "We have come to the evening, and in the evening the dominion belongs to God; praise be to God; there is no god but God alone who has no partner; to Him belongs the dominion, to Him praise is due, and He is omnipotent. O God, I ask The:
"We have come to the morning, and in the morning the dominion belongs to God ..." A version has, "My Lord, I seek refuge in Thee from a punishment in hell and a punishment in the grave."
Abu Huraira reported God’s messenger as saying that when any of them went to bed he should dust his bedding with the inner extremity of his lower garment, for he does not know what has come on to it since he left it. He should then say, “In Thy name, my Lord, I lay down my side and in Thee I raise it up. If Thou keepest my soul have mercy on it, but if Thou lettest it go guard it with that with which Thou guardest Thy upright servants.” A version says that he should then lie down on his right side and say, “In Thy name...”
(Bukhari and Muslim). A version says he should dust it three times with the border of his garment, and has “If Thou keepest my soul grant it pardon.”
In connection with God’s words, “Among them are some who wrong themselves, some who follow a middle course, and some who are foremost in good deeds,” Usama b. Zaid reported the Prophet as saying, “They will all go to paradise.”
Baihaqi transmitted it in Kitab al-ba'th wan-nushur.