The Messenger of Allah ﷺ said, "When one of you feels pain, let him place his hand where he feels the pain 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 of this pain of mine.' Then let him lift his hand and repeat this an odd number of times."
أن رسول الله ﷺ قال: إذا اشتكى أحدكم فليضع يده حيث يشتكي، ثم يقول: بسم الله، أعوذ بعزة الله وقدرته من شر ما أجد من وجعي هذا، ثم يرفع يده ثم يعيد ذلك وترا.
Tirmidhi (3588) narrated it, and Hakim graded it sahih (4/219), from the hadith of Abdul-Warith bin Abdul-Samad, who said, my father told me, Muhammad bin Salim told us, Thabit Bunani told us, from Anas bin Malik, and he related the hadith.Its chain is hasan because of Muhammad bin Salim, who is acceptable ("there is no harm in him") as Abu Hatim said, and Ibn Hibban mentioned him in Thiqat (7/396).