The Messenger of Allah ﷺ said, "When one of you passes wind silently during the prayer, he should leave, perform ablution, and repeat the prayer."
حدثنا عثمان بن أبي شيبة حدثنا جرير بن عبد الحميد عن عاصم الأحول عن عيسى بن حطان عن مسلم بن سلام
قال رسول الله ﷺ إذا فسا أحدكم في الصلاة فلينصرف فليتوضأ وليعد الصلاة
[Its chain is hasan] Tirmidhi reported it in Kitab al-Ridaa, chapter on the dislike of approaching women in their rears, no. 1164, 1166, from the hadith of Asim al-Ahwal through the same chain, and said, hasan. Ibn Hibban graded it sahih (Mawarid), no. 203, 204, 1301.