Qays bin Abu Hazim reported,

We visited Khabab to check on him during his illness, and he had been cauterized seven times. He said, "Our companions who passed before us departed without having their reward diminished by worldly gain, but we have acquired wealth for which we find no place except the dust. Were it not that the Prophet ﷺ forbade us from praying for death, I would have prayed for it."Then we came to him another time while he was building a wall for himself, and he said, "A Muslim is rewarded for everything he spends, except for something he places in this dust."

Bukhari 5672

Sahih

حدثنا آدم حدثنا شعبة عن إسماعيل بن أبي خالد

عن قيس بن أبي حازم قال

دخلنا على خباب نعوده وقد اكتوى سبع كيات فقال إن أصحابنا الذين سلفوا مضوا ولم تنقصهم الدنيا وإنا أصبنا ما لا نجد له موضعا إلا التراب ولولا أن النبي ﷺ نهانا أن ندعو بالموت لدعوت به ثم أتيناه مرة أخرى وهو يبني حائطا له فقال إن المسلم ليؤجر في كل شيء ينفقه إلا في شيء يجعله في هذا التراب

البخاري 5672صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Sick
Chapter
Wishing for death by the sick person
Numbering
Darussalam 5672
Bukhari 5672