Is it obligatory to say the Shahada when going to sleep?
Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
It is absolutely not a Wajib (obligation) to say the Shahada when going to sleep.
However, if a person says it before sleeping, then this is a good thing, because if he dies when asleep, the last of his words would have been “La Ilaha Illah Allah”. And so, the meaning of the Hadith applies to him that “Whoever his last word from this world is ‘La Ilaha Illa Allah’ he would enter
We draw your attention that there are many forms of remembrance to be said before sleeping:
- Whoever reads Ayah Al-Kursi before sleeping will be protected from Satan until he wakes up.
Bukhari reported a long Hadith on this narrated by Abu Hurairah from the Prophet (Sallallahu Alaihi wa Sallam). To supplicate: O Allah, I submit my soul unto You, and I entrust my affair unto You, and I turn my face towards You, and I totally rely on You, in hope and fear of You.Verily there is no refuge or safe haven from you except with you. I believe in Your Book which you have revealed and in Your Prophet (Sallallahu Alaihi wa Sallam) whom you have sent.” If you then die, you will die upon the Fitrah. [Reported by Bukhari and Muslim]
Allah knows best
You can search for fatwa through many choices