حَدَّثَنَا هَارُونُ بْنُ مَعْرُوفٍ ، حَدَّثَنَا عَبْدُ اللهِ بْنُ وَهْبٍ قَالَ : أَخْبَرَنِي عَمْرٌو ، عَنْ عَبْدِ رَبِّهِ بْنِ سَعِيدٍ قَالَ : حَدَّثَنِي الْمِنْهَالُ بْنُ عَمْرٍو ، وَمَرَّةً قَالَ : أَخْبَرَنِي سَعِيدُ بْنُ جُبَيْرٍ ، عَنْ عَبْدِ اللهِ بْنِ الْحَارِثِ ، عَنِ ابْنِ عَبَّاسٍ قَالَ : كَانَ رَسُولُ اللهِ - صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ - إِذَا عَادَ الْمَرِيضَ جَلَسَ عِنْدَ رَأْسِهِ ، ثُمَّ قَالَ سَبْعَ مَرَّاتٍ : أَسْأَلُ اللهَ الْعَظِيمَ رَبَّ الْعَرْشِ الْعَظِيمِ أَنْ يَشْفِيَكَ ، قَالَ : فَإِنْ كَانَ فِي أَجَلِهِ تَأْخِيرٌ عُوفِيَ مِنْ وَجَعِهِ ذَلِكَ .
It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that when the Messenger of Allah (peace and blessings be upon him) visited a sick person, he would sit by his head and recite this supplication seven times: 'As'alu Allaha al-'Azima Rabba al-'Arshi al-'Azimi an yashfiyak' (I ask Allah the Magnificent, Lord of the Magnificent Throne, to grant you healing). If there was still some respite in his appointed term, he would recover from that illness.
Related hadith on this topic