In the name of Allah, the Gracious, the Merciful
Al-Mundhiri recorded the following chapter in his book Al-Targhib wal-Tarhib:
الترغيب في الرجاء وحسن الظن بالله عز وجل سيما عند الموت
Encouragement of hope and good thoughts about Allah Almighty, especially at the time of death.
Source: al-Targhīb wal-Tarhīb 4/267
Anas ibn Malik reported: The Messenger of Allah, peace and blessings be upon him, said:
قَالَ اللَّهُ تَبَارَكَ وَتَعَالَى يَا ابْنَ آدَمَ إِنَّكَ مَا دَعَوْتَنِي وَرَجَوْتَنِي غَفَرْتُ لَكَ عَلَى مَا كَانَ فِيكَ وَلَا أُبَالِي يَا ابْنَ آدَمَ لَوْ بَلَغَتْ ذُنُوبُكَ عَنَانَ السَّمَاءِ ثُمَّ اسْتَغْفَرْتَنِي غَفَرْتُ لَكَ وَلَا أُبَالِي يَا ابْنَ آدَمَ إِنَّكَ لَوْ أَتَيْتَنِي بِقُرَابِ الْأَرْضِ خَطَايَا ثُمَّ لَقِيتَنِي لَا تُشْرِكُ بِي شَيْئًا لَأَتَيْتُكَ بِقُرَابِهَا مَغْفِرَةً
Allah Almighty said: O son of Adam, if you call upon me and place your hope in me, I will forgive you without hesitation. O son of Adam, if you have sins piling up to the clouds and then ask for my forgiveness, I will forgive you without hesitation. O son of Adam, if you come to me with enough sins to fill the earth and then you meet me without associating anything with me, I will come to you with enough forgiveness to fill the earth.
Source: Sunan al-Tirmidhī 3540, Grade: Sahih
Anas ibn Malik reported: The Prophet, peace and blessings be upon him, entered the home of a young man in the throes of death. The Prophet said:
How do you feel?
The man said, “By Allah, O Messenger of Allah, I hope in Allah and I fear for my sins.” The Prophet said:
لَا يَجْتَمِعَانِ فِي قَلْبِ عَبْدٍ فِي مِثْلِ هَذَا الْمَوْطِنِ إِلَّا أَعْطَاهُ اللَّهُ مَا يَرْجُو وَآمَنَهُ مِمَّا يَخَافُ
These two feelings are not combined in the heart of a servant in this situation but that Allah will give him what he hopes and save him from what he fears.
Source: Sunan al-Tirmidhī 983, Grade: Jayyid
Abu Huraira reported: The Messenger of Allah, peace be and blessings on him, said:
يَقُولُ اللَّهُ تَعَالَى أَنَا عِنْدَ ظَنِّ عَبْدِي بِي وَأَنَا مَعَهُ إِذَا ذَكَرَنِي فَإِنْ ذَكَرَنِي فِي نَفْسِهِ ذَكَرْتُهُ فِي نَفْسِي وَإِنْ ذَكَرَنِي فِي مَلَإٍ ذَكَرْتُهُ فِي مَلَإٍ خَيْرٍ مِنْهُمْ وَإِنْ تَقَرَّبَ إِلَيَّ بِشِبْرٍ تَقَرَّبْتُ إِلَيْهِ ذِرَاعًا وَإِنْ تَقَرَّبَ إِلَيَّ ذِرَاعًا تَقَرَّبْتُ إِلَيْهِ بَاعًا وَإِنْ أَتَانِي يَمْشِي أَتَيْتُهُ هَرْوَلَةً
Allah Almighty says: I am as my servant expects me and I am with him as he remembers me. If he remembers me in himself, I will remember him in myself. If he mentions me in a gathering, I will mention him in a greater gathering. When he draws near me by the span of his hand, I draw near him by the length of a cubit. When he draws near me by the length of a cubit, I draw near him by the length of a fathom. When he comes to me walking, I come to him running.
Source: Ṣaḥīḥ al-Bukhārī 6970, Grade: Muttafaqun Alayhi
In another narration, the Prophet said:
إِنَّ اللَّهَ جَلَّ وَعَلا يَقُولُ أَنَا عِنْدَ ظَنِّ عَبْدِي بِي إِنْ ظَنَّ خَيْرًا فَلَهُ وَإِنْ ظَنَّ شَرًّا فَلَهُ
Allah Almighty says: I am as my servants expects me. If he thinks good of me, he will have it. If he thinks evil of me, he will have it.
Source: Ṣaḥīḥ Ibn Ḥibbān 639, Grade: Sahih
Jabir reported: I heard the Messenger of Allah, peace and blessings be upon him, say three days before his death:
لَا يَمُوتَنَّ أَحَدُكُمْ إِلَّا وَهُوَ يُحْسِنُ بِاللَّهِ الظَّنَّ
None of you should die without expecting good from Allah.
Source: Ṣaḥīḥ Muslim 2877, Grade: Sahih
Hayyan Abi al-Nadrah reported: I went out to visit Yazid ibn al-Aswad as he was suffering a fatal illness, and I met Wathilah ibn al-Asqa’ who also wanted to visit him. We entered Yazid’s home and Wathilah said, “What do you expect from Allah?” Yazid said, “By Allah, I expect good from Allah.” Wathilah said:
فَأَبْشِرْ فَإِنِّي سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ قَالَ اللَّهُ جَلَّ وَعَلا أَنَا عِنْدَ ظَنِّ عَبْدِي بِي إِنْ ظَنَّ خَيْرًا وَإِنْ ظَنَّ شَرًّا
Rejoice! For I heard the Messenger of Allah, peace and blessings be upon him, say that Allah Almighty said: I am as my servant expects me. If he expects good, he will have it. If he expects evil, he will have it.
Source: Ṣaḥīḥ Ibn Ḥibbān 641, Grade: Sahih
Success comes from Allah, and Allah knows best.