Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
tirmidhi:2087ʿAbdullāh b. Saʿīd al-Ashaj > ʿUqbah b. Khālid al-Sakūnī > Mūsá b. Muḥammad b. Ibrāhīm al-Taymī from his father > Abū Saʿīd al-Khudrī

"When one of you visits the ill, then reassure him regarding his lifespan. Indeed that will not repel anything, but it will comfort his soul."  

Abū ʿĪsá said that this Ḥadīth is Gharīb.
الترمذي:٢٠٨٧حَدَّثَنَا عَبْدُ اللَّهِ بْنُ سَعِيدٍ الأَشَجُّ قال حَدَّثَنَا عُقْبَةُ بْنُ خَالِدٍ السَّكُونِيُّ عَنْ مُوسَى بْنِ مُحَمَّدِ بْنِ إِبْرَاهِيمَ التَّيْمِيِّ عَنْ أَبِيهِ عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ قَالَ

قَالَ رَسُولُ اللَّهِ ﷺ إِذَا دَخَلْتُمْ عَلَى الْمَرِيضِ فَنَفِّسُوا لَهُ فِي أَجَلِهِ فَإِنَّ ذَلِكَ لاَ يَرُدُّ شَيْئًا وَيُطَيِّبُ نَفْسَهُ  

قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ غَرِيبٌ

See similar narrations below:

Collected by Ibn Mājah, Suyūṭī
ibnmajah:1438Abū Bakr b. Abū Shaybah > ʿUqbah b. Khālid al-Sakūnī > Mūsá b. Muḥammad b. Ibrāhīm al-Taymī from his father > Abū Saʿīd al-Khudrī

“When you enter upon one who is sick, cheer him up and give him hope of a long life, for that does not change anything (of the Divine Decree), but it will cheer the heart of the one who is sick.”  

ابن ماجة:١٤٣٨حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ حَدَّثَنَا عُقْبَةُ بْنُ خَالِدٍ السَّكُونِيُّ عَنْ مُوسَى بْنِ مُحَمَّدِ بْنِ إِبْرَاهِيمَ التَّيْمِيِّ عَنْ أَبِيهِ عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ قَالَ

قَالَ رَسُولُ اللَّهِ ﷺ إِذَا دَخَلْتُمْ عَلَى الْمَرِيضِ فَنَفِّسُوا لَهُ فِي الأَجَلِ فَإِنَّ ذَلِكَ لاَ يَرُدُّ شَيْئًا وَهُوَ يَطِيبُ بِنَفْسِ الْمَرِيضِ  

suyuti:1781a

“When you enter upon one who is sick, cheer him up and give him hope of a long life, for that does not change anything (of the Divine Decree), but it will cheer the heart of the one who is sick.” (Using translation from Ibn Mājah 1438)   

السيوطي:١٧٨١a

"إِذا دَخَلتُم على المريضِ فَنَفِّسُوا لهُ في الأجلِ فإِن ذلكَ لا يَرُد شيئًا وهو يطيب بنفس المريض".  

[ت] الترمذي [هـ] ابن ماجة وابن السنى في عمل اليوم واليلة، [هب] البيهقى في شعب الإيمان وضعفَه عن أبي سعيد