Sunan an-Nasa'i, Book 21, Hadith 1 (In-Book)

It was narrated from Abu Hurairah that the Messenger of Allah said: "None of you should wish for death. Either he is a doer of good, so perhaps he may do more good, or he is an evildoer but perhaps he will give up his evil ways."

أَخْبَرَنَا هَارُونُ بْنُ عَبْدِ اللَّهِ، حَدَّثَنَا مَعْنٌ، قَالَ حَدَّثَنَا إِبْرَاهِيمُ بْنُ سَعْدٍ، عَنِ الزُّهْرِيِّ، عَنْ عُبَيْدِ اللَّهِ بْنِ عَبْدِ اللَّهِ بْنِ عُتْبَةَ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ لاَ يَتَمَنَّيَنَّ أَحَدٌ مِنْكُمُ الْمَوْتَ إِمَّا مُحْسِنًا فَلَعَلَّهُ أَنْ يَزْدَادَ خَيْرًا وَإِمَّا مُسِيئًا فَلَعَلَّهُ أَنْ يَسْتَعْتِبَ ‏" ‏ ‏.‏

sunnah.com