The Messenger of Allah ﷺ said, "When you visit a sick person, give him hope of a long life. Though this changes nothing of what is decreed, it comforts his heart."
حدثنا عبد الله بن سعيد الأشج حدثنا عقبة بن خالد السكوني عن موسى بن محمد بن إبراهيم التيمي عن أبيه
قال رسول الله ﷺ إذا دخلتم على المريض فنفسوا له في أجله فإن ذلك لا يرد شيئا ويطيب نفسه
[Its chain of transmission is daif]. Ibn Majah narrated it in the Book of Funerals, chapter on what has been said regarding visiting the sick, no. 1438, from the hadith of Uqba bin Khalid, with this wording. Musa bin Muhammad is munkar al-hadith, as stated in Taqrib and elsewhere.