Mishkat al-Masabih 2404
وَعَنْ أَبِي سَعِيدٍ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: مَنْ قَالَ حِينَ يَأْوِي إِلَى فِرَاشِهِ: أَسْتَغْفِرُ اللَّهَ الَّذِي لَا إِله إِلا هوَ الحيَّ القيومَ وأتوبُ إِليهِ ثَلَاثَ مَرَّاتٍ غَفَرَ اللَّهُ لَهُ ذُنُوبُهُ وَإِنْ كَانَتْ مِثْلَ زَبَدِ الْبَحْرِ أَوْ عَدَدَ رَمْلِ عَالَجٍ أَوْ عَدَدَ وَرَقِ الشَّجَرِ أَوْ عَدَدَ أَيَّامِ الدُّنْيَا . رَوَاهُ التِّرْمِذِيُّ وَقَالَ: هَذَا حَدِيثٌ غَرِيب
From Abu Saʿid, who said: The Messenger of Allah ﷺ said: "Whoever says when he goes to his bed: I seek the forgiveness of Allah, besides whom there is no god, the Ever-Living, the Sustainer, and I repent to Him, three times, Allah will forgive him his sins, even if they are like the foam of the sea, or the number of the grains of sand of ʿAlij, or the number of the leaves of the trees, or the number of the days of this world." Reported by at-Tirmidhi, and he said: This is a gharib hadith.