The hadith is from Jam'i al-Tirmidhi - see hadith 3527 - last part of the hadith.
The Prophet Muhammad saw saw a man pray for sabr (The man said, Allahumma inni asaluka al-sabr). In response, the Prophet Muhammad saw said to him, you asked Allah for trials (bala). Ask him for well-being (al-`afiyya).
ʿAbdullah bin ʿUmar (may Allah be pleased with them) reported: The Messenger of Allah (PBUH) used to supplicate thus: "Allahumma inni a`udhu bikamin zawali ni`matika, wa tahawwuli `afiyatika, wa fujaati niqmatika, wa jami`i 5. sakhatika (O Allah! I seek refuge in You against the declining of Your Favours, unstability/change of well-being, the suddenness of Your punishment and all that which displeases You).[Muslim].
`Afiyah means safety from disease, grief and troubles. Passing of the safety (`Afiyah) signifies the change from a state of good health to a state of illness and weakness or that one is overtaken by troubles and afflictions.