The Messenger of Allah ﷺ said, "None of you should wish for death. If he is a wrongdoer, he may yet seek forgiveness, and if he is a doer of good, he may yet increase in good deeds."
حدثنا روح حدثنا محمد بن أبي حفصة حدثنا ابن شهاب عن أبي عبيد مولى عبد الرحمن بن عوف
قال رسول الله ﷺ لا يتمنى أحدكم الموت إما مسيء فيستغفر أو محسن فيزداد
Its isnad is sahih. Abu Ubayd is Saad bin Ubayd, and the correct view is that he was the freedman of Abdul-Rahman bin Azhar, not of Ibn Awf, as mentioned at 7568. The hadith was narrated by Bukhari 7/157, in the Book of Illnesses, chapter on a sick person wishing for death, and Muslim 4/2065 number 2682, and Abu Dawud 3/188 number 3109, from Anas, and Nasai 4/302 numbers 1818 and 1819, and Ibn Majah 4265.