Anas bin Malik (May Allah be pleased with him) reported: Messenger of Allah (PBUH) said, "Let none of you wish for death on account of an affliction that befalls him. If he has no alternative, let him pray: 'Allahumma ahyine ma kanatil-hayatu khairan li, wa tawaffani idha kanatil-wafatu khairan li (O Allah! Give my life so long as the life is good for me, and take away my life if death is good for me)'."