The Prophet ﷺ said, "Allah accepts the repentance of His servant as long as the death rattle has not reached his throat."
عن النبي ﷺ قال: إن الله يقبل توبة عبده ما لم يغرغر.
Tirmidhi (3537), Ibn Majah (4253), and Ahmad (6160) all narrated it, and Ibn Hibban (628) and Hakim (4/257) both graded it sahih, all of them through various routes from Abdul-Rahman bin Thabit bin Thawban, from his father, from Makhul, from Jubayr bin Nufayr, from Ibn Umar, and he related it. Except that Ibn Majah said, "Abdullah bin Amr," which is an error, as Mizzi pointed out in Tuhfah (5/328).Its chain is hasan because of Abdul-Rahman bin Thabit bin Thawban, for his hadith is hasan. Tirmidhi said, "This is a hasan gharib hadith." Hakim said, "This is a hadith sahih in its chain."