The Messenger of Allah ﷺ said, "None of you should wish for death, nor pray for it before it comes. When one of you dies, his deeds come to an end. The lifespan of a believer adds nothing to him but good."
قال رسول الله ﷺ: لا يتمنى أحدكم الموت، ولا يدع به من قبل أن يأتيه، إنه إذا مات أحدكم انقطع عمله. وإنه يزيد المؤمن عمره إلا خيرا.
Muslim narrated it in the Book of Remembrance and Supplication (2682) through the hadith of Hammam bin Munabbih, who said, "This is what Abu Hurairah narrated to us from the Messenger of Allah ﷺ," and he then mentioned several hadiths, among them this hadith.