Anas bin Malik reported,

The Prophet ﷺ visited a young man who was on the verge of death and asked him, "How do you feel?"The young man replied, "By Allah, Messenger of Allah, I hope in Allah, and I fear my sins."The Messenger of Allah ﷺ said, "These two do not come together in the heart of a servant at such a moment without Allah granting him what he hopes for and protecting him from what he fears."

Tirmidhi 983

Hasan

حدثنا عبد الله بن أبي زياد الكوفي وهارون بن عبد الله البزاز البغدادي قالا حدثنا سيار هو ابن حاتم حدثنا جعفر بن سليمان عن ثابت

عن أنس

أن النبي ﷺ دخل على شاب وهو في الموت فقال كيف تجدك قال والله يا رسول الله أني أرجو الله وإني أخاف ذنوبي فقال رسول الله ﷺ لا يجتمعان في قلب عبد في مثل هذا الموطن إلا أعطاه الله ما يرجو وآمنه مما يخاف

الترمذي 983حسن
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Funerals
Chapter
Hope in Allah and fear of sin at the time of death
Numbering
Darussalam 983
Tirmidhi 983