The Messenger of Allah ﷺ said, "When one of you feels movement in his backside during prayer and is uncertain whether he has broken his ablution or not, he should not leave the prayer until he hears a sound or detects an odor."
حدثنا عفان حدثنا حماد بن سلمة قال حدثنا سهيل بن أبي صالح عن أبيه
أن رسول الله ﷺ قال إذا وجد أحدكم في صلاته حركة في دبره فأشكل عليه أحدث أو لم يحدث فلا ينصرف حتى يسمع صوتا أو يجد ريحا
Its chain of transmission is sahih. Bukhari related it, 1/64, no. 137, in wudu, "one does not perform wudu on account of mere doubt," and Muslim, 1/276, no. 362, in menstruation, "the proof that one who is certain of purity," and Abu Dawud, 1/45, no. 177, in purification, "when one doubts having broken purity," and Nasai, 1/98, no. 160, in purification, "wudu on account of passing wind."