The Messenger of Allah ﷺ said, "None of you should wish for death. If he is a doer of good, perhaps he will increase his good deeds, and if he is a wrongdoer, perhaps he will seek to make amends."
أن رسول الله ﷺ قال: لا يتمنى أحدكم الموت، إما محسنا فلعله يزداد، وإما مسيئا فلعله يستعتب.
Bukhari narrated it in the Book of Wishing (7235) from Abdullah bin Muhammad, who said, Hisham bin Yusuf narrated to us, who said, Mamar informed us, from Zuhri, from Abu Ubayd, whose name is Saad bin Ubayd, the freed slave of Abdul-Rahman bin Azhar, from Abu Hurairah, and he related it.Note, the phrase "from Abu Hurairah" is missing from the printed edition of Sahih Bukhari, and it is correct to include it, as found in Tuhfat Ashraf (9/464), and in Al-Jam Bayn Al-Sahihayn by Humaydi (2456). Bukhari also narrated it in the Book of the Sick (5673) through the route of Shuayb from Zuhri with the same chain, including "Abu Hurairah," along with an addition at the beginning of the hadith.