Abu Umamah reported: The Messenger of Allah, peace and blessings be upon him, said, “If Allah wills goodness for a servant, He purifies him before his death.” They said, “O Messenger of Allah, what is the purification of the servant?” The Prophet said, “He inspires him to perform good deeds until his soul is taken.”
Source: al-Mu’jam al-Kabīr 7900
Grade: Sahih (authentic) according to Al-Albani
عَنْ أَبِي أُمَامَةَ قَالَ قَالَ رَسُول اللهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ إِذَا أَرَادَ اللهُ بِعَبْدٍ خَيْرًا طَهَّرَهُ قَبْلَ مَوْتِهِ قَالُوا يَا رَسُولَ اللهِ وَمَا طَهُورُ الْعَبْدِ قَالَ عَمَلٌ صَالِحٌ يُلْهِمُهُ إِيَّاهُ حَتَّى يَقْبِضَهُ عَلَيْهِ
7900 المعجم الكبير
306 المحدث الألباني خلاصة حكم المحدث صحيح في صحيح الجامع