Hadith 968
Sayyiduna Anas bin Malik (may Allah be pleased with him) narrates about the Noble Prophet (peace and blessings be upon him): He said: No person should ever wish for death because of any hardship that befalls him. If he must do so, then he should say: "O Allah! Keep me alive as long as life is better for me, and give me death when death is better for me."