Shaddad b. Aus reported God’s messenger as saying, "If any Muslim recites a sura from God’s Book when he goes to bed, God will put an angel in charge of him, and nothing which may harm him will come near him till he wakes".
Abu Sa'id reported God's messenger as saying that if anyone says three times when going to bed, "I ask the forgiveness of God than whom there is no god, the Living, the Eternal, and I turn in repentance to Him," God will forgive him his sins, even if they are like the foam of the sea, or in number like the sand which is accumulated,* or as many as the leaves of the trees, or as numerous as the days of this world.
*The word is ‘alij. Some say ‘Alij is a place in the desert, the translation being ‘the sand of ‘Alij; others treat it as translated above.
Tirmidhi transmitted it, saying this is a gharib tradition.
‘Abdallah b. ‘Amr b. al-‘As reported God’s messenger as saying there are two characteristics which will not be retained by any Muslim without his entering paradise. While they are easy, those who act upon them are few. One should say ‘Glory be to God’ ten times after every prayer, ‘Praise be to God’ ten times and ‘God is most great’ ten times. (He said he had seen God’s messenger counting them on his hand, and saying, “That is a hundred and fifty on the tongue, but one thousand five hundred in the scale”). When he goes to his bed he should say ‘Glory be to God,’ ‘God is most Great’ and ‘Praise be to God’ a hundred times, for that is a hundred on the tongue, but a thousand in the scale. He asked them which of them could commit two thousand five hundred sins in a day and a night.* He was asked how they could not retain these characteristics, and told them that the devil comes to a man while he is engaged in prayer, calling such and such and such and such to his memory until he turns away and perhaps may not do it. He also comes to him on his bed and keeps on making him sleep till he falls asleep.
*The thousand plus the preceding fifteen hundred make two thousand five hundred good deeds with which the man who observes the two characteristics mentioned is credited, and as one could hardly commit as many sins in a day and a night there is a balance in his favour.
Tirmidhi, Abu Dawud and Nasa’i transmitted it. In Abu Dawud's version he said, “Two qualities or two characteristics will not be adhered to by a Muslim ...” And also in his version after saying “One thousand five hundred in the scale” he said, “When he goes to his bed he should say ‘God is most great’ thirty-four times, ‘Praise be to God’ thirty-three times and ‘Glory be to God’ thirty-three times.” In most texts of al-Masabih it is given on the authority of ‘Abdallah b. ‘Umar.
‘Ali reported that God’s messenger used to say when he lay down, "O God, I seek refuge in Thy noble Person and in Thy perfect words from the evil of what Thou seizest by its forelock; O God, Thou removest debt and sin; O God, Thy troop is not routed, Thy promise is not broken, and the riches of the rich do not avail against Thee. Glory and praise be unto Thee."