It is also related from Anas ibn Mālik (may Allah be pleased with him) that he said, “We were instructed to ask Allah’s forgiveness during the night seventy times.”
What one should say when startled or unable to sleep because of anxiety:
Buraidah (may Allah be pleased with him) reported: “Khalid ibn al-Walid complained to the Messenger of Allah, peace and blessings be upon him, saying, ‘O Messenger of Allah, I cannot sleep at night because of sleeplessness.’ The Prophet replied, ‘When you lie down on your bed, say:
‘O Allah, Lord of the seven heavens and all they shade, Lord of the seven earths and all they carry, Lord of the devils and all those they lead astray, be my Protector against the evil of every creature of Yours, lest any one of them overstep the bounds with me or act unjustly toward me. Mighty is Your protection, exalted is Your praise; there is no shelter apart from You, and there is no god but You.’” Reported by al-Tirmidhī.
ʿAmr ibn Shuʿayb, from his father, from his grandfather, narrated that the Messenger of Allah, peace and blessings be upon him, used to teach them, when they were frightened, these words: “I seek refuge in the perfect words of Allah from His wrath, from the evil of His servants, from the devils’ whisperings, and from their presence.”