Abu Hurairah reported,

The Messenger of Allah ﷺ was reported to have said several things, among them, "None of you should wish for death or pray for it before it comes to him. When one of you dies, his deeds come to an end, and the believer's lifespan only increases him in goodness."

Muslim 6819

Sahih

حدثنا محمد بن رافع حدثنا عبد الرزاق أخبرنا معمر عن همام بن منبه قال هذا ما

حدثنا أبو هريرة

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

مسلم 6819صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Remembrance, supplication, Tawba, and seeking forgiveness
Chapter
Dislike of wishing for death due to hardship that has befallen one
Numbering
Darussalam 6819
Muslim 6819