It was narrated from Ibn Umar that the Messenger of Allah (ﷺ) said:
"(Allah says) O son of Adam! I have given you two things which you do not deserve (except by mercy of Allah (SWT)): I allow you to dispose of a share of your wealth when you are on your deathbed, in order to cleanse and purify you, and my slaves pray for you after your life is over."
English reference: Vol. 3, Book 22, Hadith 2710
Arabic reference: Book 22, Hadith 2814