If a praying person is in doubt whether he has passed wind or not, or if he feels movement or gasses in his abdomen, should he stop prayer or continue?
If he knows without doubt that wind has passed, then he should leave the prayer. However, if he is in doubt but is not certain, then he should not leave unless he becomes certain--by hearing the wind pass or smelling it. If he finds that he has passed wind, he should leave; otherwise he should pay no attention to it. The evidence: Abu Huriara, (may Allah be pleased with him) said, "The Messenger of Allah (peace be upon him) said: 'If one is in prayer and feels movement in his behind, (and is in question whether) he has passed wind or not, and he is in doubt, then he should not leave unless he hears the sound or detects the smell".1 And this is one of the significant Islamic prescriptions for curing waswasa (insinuations from the whispering of shaitan [Satan]).
From the book What Should You Do in the Following Situations... ?
1 Abu Dawood 177, and Sahih al-Jaami 750.