These hadeeths, mentioned by An-Nawawee – may Allah shower blessings on him – in his Book Riyaadus Saaliheen, are related to what to say when one visits a sick person.
The hadeeth of Sa'd bin Abee Waqqas - may Allah be pleased with him - that the Prophet ﷺ visited him while he was bedridden and said: 'O Allah heal Sa'd, O Allah heal Sa'd, O Allah heal Sa'd,' three times.
There is evidence in this hadeeth that it is Sunnah to visit a sick Muslim. Similarly, it shows the kind character of the Prophet ﷺ and his relationship with his companions; he would visit the sick amongst them and supplicate for them.
In addition, it shows the virtue of supplicating with this invocation: 'O Allah heal so and so,' mentioning the name of the person thrice. This is one of the means of cure for the sick.
Also, it demonstrates that one may repeat the supplication. Whenever the Messenger of Allah ﷺ supplicated, he would repeat it three times. Whenever he offers greeting and the other party could
not hear, he would repeat it thrice. The act of repeating supplications thrice is established in the Sharee'ah as he ﷺ would do during Salat; he would say: 'Rabbighfirlī, Rabbighfirlī, Rabbighfirlī – O my Lord forgive me, O my Lord forgive me, O my Lord forgive me,' repeating it. This is also established for the supplication for the sick.
Then he mentioned the hadeeth of Uthman bin Abee Al-'Aas - may Allah be pleased with him- when he complained to the Prophet ﷺ about a pain he had in his body. So, the Prophet ﷺ instructed him to recite this supplication: 'Bismillaah – (With the name of Allah) three times. He should put his hand where he feels the pain and say: A'udhu bi 'Izzatillaahi wa Qudratihi min sharri maa ajidu wa uhaadhir - I seek refuge in the Honored of Allah and His Might from what I feel and what I apprehend.' He would repeat it seven times. This is also one of the means of cure.
When a person experiences any pain, he should put his hand on the spot and say: 'With the name of Allah (three times), I seek refuge in the Honored of Allah and His Might from what I feel and what I apprehend,' saying it seven times. When he says this with certainty and believing that he will benefit from it, the pain will definitely abate by the leave of Allah. This is more effective than perceptible drugs such as tablets, syrups and injection. In the case of the former, you are seeking refuge from the One Who owns the Dominion of the Heavens and the Earth, the One Who has sent down the illness and the One Who is capable of removing it.
Also, the hadeeth of Ibn Abbas - may Allah be pleased with him and his father- that when a person visits a sick person who is not on the point of death, and he supplicates: As-alullaaha Al-'Azeem Rabba al-'Arsh il-'Azeem and Yashfiyak - I ask Allah the Most Great, Lord of the Great Throne, to heal you.' Allah will heal him of that ailment.' This is when he is not on the verge of death. However, if he is on the verge of death, then neither medicine nor supplication can benefit him because Allah - the most High said:
“And every nation has its appointed term; when their term is reached, neither can they delay it nor advance it an hour (or a moment).” (Al-Araf: 34)
Allah alone grants success.