It was narrated from Anas that the Messenger of Allah (ﷺ) said:“None of you should wish for death because of some harm that befalls him. If he must wish for death, let him say: ‘O Allah, keep me alive so long as living is good for me and cause me to die when death is good for me.’”
Hadith No. 4265
Sunan Ibn Majah
Gradings:
Al-Albani:
Sahih
Muhammad Fouad Abd al-Baqi:
Sahih
Shuaib Al Arnaut:
Sahih
Zubair Ali Zai:
Isnaad Sahih