Sahih al-Bukhari, Hadith 6351 ⓘ
Narrated Anas: Allah's Messenger said," None of you should long for death because of a calamity that had befallen him, and if he cannot, but long for death, then he should say, 'O Allah! Let me live as long as life is better for me, and take my life if death is better for me.' "
حَدَّثَنَا ابْنُ سَلاَمٍ، أَخْبَرَنَا إِسْمَاعِيلُ ابْنُ عُلَيَّةَ، عَنْ عَبْدِ الْعَزِيزِ بْنِ صُهَيْبٍ، عَنْ أَنَسٍ ـ رضى الله عنه ـ قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " لاَ يَتَمَنَّيَنَّ أَحَدٌ مِنْكُمُ الْمَوْتَ لِضُرٍّ نَزَلَ بِهِ، فَإِنْ كَانَ لاَ بُدَّ مُتَمَنِّيًا لِلْمَوْتِ فَلْيَقُلِ اللَّهُمَّ أَحْيِنِي مَا كَانَتِ الْحَيَاةُ خَيْرًا لِي، وَتَوَفَّنِي إِذَا كَانَتِ الْوَفَاةُ خَيْرًا لِي " .
also referenced under: Book 80, Hadith 48 (In-Book) & Volume 8, Book 75, Hadith 362 (USC-MSA)