The Prophet ﷺ said, "Whoever says when he goes to bed, 'There is no god but Allah alone, with no partner. To Him belongs all dominion and all praise, and He has power over all things. There is no might nor power except through Allah. Glory be to Allah, praise be to Allah, there is no god but Allah, and Allah is the greatest,' Allah will forgive his sins, or his wrongdoings, even if they are like the foam of the sea."
عن النبي ﷺ قال: من قال حين يأوي إلى فراشه: لا إله إلا الله وحده لا شريك له له الملك وله الحمد وهو على كل شيء قدير لا حول ولا قوة إلا بالله سبحان الله والحمد لله ولا إله الله والله أكبر غفر الله ذنوبه أو خطاياه، وإن كان مثل زبد البحر.
Ibn Hibban (5528), Ibn Sunni in Amal al-Yawm wal-Layla (724), and Abu Naeem in Akhbar Isbahan (1/267) all narrated it through various routes from Misar bin Kidam, from Habib bin Abu Thabit, from Abdullah bin Babah, from Abu Hurairah, who said, then he mentioned it. Its chain of transmission is sahih.Ibn Abu Shayba (29307) narrated it through Amash, and Nasai in Kubra (10578) through Shubah and Thawri, all of them (Amash, Shubah, and Thawri) narrating it from Habib bin Abu Thabit as a stopped report (mawquf).There is no doubt that the mawquf version has the stronger chain, which is why Daraqutni favored it in Ilal (2115). However, the ruling goes to the raised version (marfu), because Misar bin Kidam is a reliable and firmly established narrator, and an addition from a reliable narrator is accepted by the majority of scholars. It appears that Habib bin Abu Thabit used to narrate it in two ways, mawquf and marfu, and the ruling belongs to whoever added more.