Not only the agonies of death reduce one’s sins, but any little afflictions are a main cause for sins being forgiven. Abu Sa`id Al-Khudri (may Allah be pleased with him) quoted the Prophet (peace and blessings be upon him) as saying, “Whenever a Muslim is afflicted by any hardship, whether it be chronic sickness, grief, harm, a disaster, or even a thorn prick, Allah will wash out some of his minor sins.” (Al-Bukhari and Muslim)
In another hadith, the Prophet (peace and blessings be upon him) is reported to have said,“Great is the state of a believer, for he is winner at any rate. If he is given a blessing and thus shows gratitude, it is good for him. If he is plagued with an affliction and thus shows patience, it is good for him.” (Muslim)
Moreover, being tested with affliction is a sign of one’s religious commitment. When the Prophet was asked which people suffered the greatest affliction, he replied, “The Prophets, then those who come next to them, then those who come next to them. A man is afflicted in keeping his religion. If he is firm in his religion his trial is severe, but if there is weakness in his religion it is made light for him, and it continues like that until he walks on the earth having no sin.” (Al-Bukhari and Ahmad)
The late Saudi scholar Sheikh Muhammad Al-`Uthaymeen states that: Yes, every sickness, difficulty, worry, or distress that befalls a person, even the prick of a thorn, is an expiation for his sins. Then if he bears it patiently and seeks reward for that with Allah, in addition to the expiation of his sins he will be rewarded for the patience with which he bears the calamity that has befallen him. It makes no difference whether that is at the time of death or before. Calamities are expiation of sins for the believer. Allah Almighty says, (And whatever of misfortune befalls you, it is because of what your hands have earned. And He pardons much.) (Ash-Shura 42: 30)
“It is because of what your hands have earned” indicates that it is an expiation for the things we have done. The Prophet (peace and blessings be upon him) is reported to have said, “Whenever a Muslim is afflicted by any hardship, whether it be chronic sickness, grief, harm, a disaster, or even a thorn prick Allah, will wash out some of his minor sins” (Al-Bukhari and Muslim).