Thabit Bunani said to me, "Muhammad, when you feel pain, place your hand on the spot where it hurts and say, 'In the name of Allah, I seek refuge in the might of Allah and His power from the evil of what I find, from this pain of mine.' Then lift your hand and repeat this an odd number of times. For Anas bin Malik told me that the Messenger of Allah ﷺ taught him this."
حدثنا ثابت البناني قال: قال لي يا محمد إذا اشتكيت، فضع يدك حيث تشتكي، وقل: بسم الله أعوذ بعزة الله وقدرته من شر ما أجد، من وجعي هذا، ثم ارفع يدك، ثم أعد ذلك وترا فإن أنس بن مالك حدثني أن رسول الله ﷺ حدثه بذلك.
Tirmidhi (3588) and Hakim (4/219) both narrated it from the hadith of Abdul-Warith bin Abdul-Samad, who said, my father narrated to me, saying, Muhammad bin Salim narrated to us, and he mentioned it. Its chain is hasan on account of Muhammad bin Salim, who is Rubai Basri. Abu Hatim said, "There is no harm in him," and Ibn Hibban mentioned him among his reliable narrators. So Hafiz's statement in Taqrib, "acceptable," is open to question. Tirmidhi said, "This is a hasan gharib hadith from this route, and this Muhammad bin Salim is a Basran shaykh." Hakim said, "This is a hadith sahih in chain."