We relate from the book of Ibn as-Sunnī that Zayd ibn Thābit narrated: “I complained to the Messenger of Allah about my sleeplessness and he said: ‘Say: O Allah, the stars have set and the eyes are resting, but You are Ever-Living, Self-Subsisting. You are not overcome by slumber or sleep. O Ever-Living, Self-Subsisting, make my night calm and my eyes sleep.’ I said this and Allah took away from me what I had been experiencing.
اَلَّلهُمَّ غَارَتِ النَُجُومُ، وَهَدَأَتِ العُيُونِ، وَأَنتَ حَيٌّ قَيُّومٌ، لَا تَأخُذُكَ سِنَةٌ وَلَا نَومٌ، يَا قَيٌّومُ، أَهدِئ لَيلِي وَأَنِم عَينِي.
“Allāhumma ghārati-n-nujūm, wa hada’ati-l-‘uyūn, wa Anta Ḥayyun Qayyūm, lā ta’khudhuka sinatun wa lā nawm. Yā Ḥayyu yā Qayyūm, ahdi’ laylī wa anim ‘aynī.”
We relate in the book of at-Tirmidhī with a weak isnād—at-Tirmidhī considered it weak—from Buraydah, who narrated that Khālid ibn Wālid complained to the Messenger of Allah, saying: “Messenger of Allah, I did not sleep last night because of insomnia.” So the Prophet told him: “When you retire to bed, say: O Allah, Lord of the Seven Heavens and all that they give shade to, Lord of the Earths and all that they support, Lord of the shayṭāns (demons) and all those whom they lead astray, be a Protector to me from all Your Creation, to prevent them from transgressing against me or oppressing me. Those whom You protect are mighty, glorious is Your praise, and there is no God other than You. There is no god but You.”
اَلَّلهُمَّ رَبَّ السَّمَاوَاتِ السَّبعِ وَمَا أَظَلَّت، وَرَبَّ الأَرضِينَ وَمَا أَقَلَّت، وَرَبَّ الشَّيَاطِينِ وَمَا أَضَلَّت، كُن لِي جَاراً مِن شَرِّ خَلقِكَ كُلِّهِم جَمِيعاً أَن يَفرُط عَلَيَّ أَحدٌ مِنهُم أَو أَن يَبغِي عَلَيَّ. عَزَّ جَارُكَ، وَجَلَّ ثَنَاؤُكَ، وَلَآ إِلَهَ غَيرُكَ. لَآ إِلَهَ إِلَّا أَنتَ.
“Allāhumma Rabba-s-samāwāti-s-sab‘i wa mā aẓallat, wa Rabba-l-arḍīna wa mā aqallat, wa Rabba-sh-shayāṭīni wa mā aḍallat, kun lī jāran min sharri khalqika kullihim jamī‘an an yafruṭa ‘alayya aḥadun minhum aw an yabghī ‘alayy, ‘Azza jāruk, wa jalla thanā‘uk, wa lā ilāha ghayruk, lā ilāha illā Ant.”