حَدَّثَنَا أَبُو خَيْثَمَةَ ، حَدَّثَنَا إِسْمَاعِيلُ ، عَنْ عَبْدِ الْعَزِيزِ بْنِ صُهَيْبٍ ، عَنْ أَنَسٍ ، قَالَ : قَالَ رَسُولُ اللهِ - صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ - : لَا يَتَمَنَّيَنَّ أَحَدُكُمُ الْمَوْتَ لِضُرٍّ نَزَلَ بِهِ ، فَإِنْ كَانَ لَا بُدَّ مُتَمَنِّيًا ، فَلْيَقُلِ : اللَّهُمَّ أَحْيِنِي مَا كَانَتِ الْحَيَاةُ خَيْرًا لِي ، وَتَوَفَّنِي إِذَا كَانَتِ الْوَفَاةُ خَيْرًا لِي .
It is narrated from Sayyiduna Anas (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "None of you should ever wish for death because of some hardship or affliction that has befallen him. But if he is compelled (by the severity of the hardship) to wish, then he should say: 'Allahumma ahyini ma kanat al-hayatu khayran li, wa tawaffani idha kanat al-wafatu khayran li' (O Allah, keep me alive as long as life is better for me, and cause me to die when death is better for me)."