Preventing Breaking Wind to Avoid Invalidating Wudu
Question

Is it prohibited to try to prevent wind from coming out during prayer or in order to stay in Wudu before prayer?
Praise be to Allah.`Aishah said: I heard the Messenger of Allah (peace and blessings of Allah be upon him) say: “One should not pray when food is ready or when one is trying to stop oneself from doing either of the two things that break Wudu (i.e., urination and defecation).” (Narrated by Muslim, 560) 
Shaykh Muhammad Al-Salih Al-‘Uthaymin (may Allah have mercy on him) was asked: 
If dinner is ready and a person wants to eat, should he start with the meal even if the time for prayer is going to end? 
He replied: 
“This is an area where the scholars differed. Some of them said that the prayer should be delayed if his mind is going to be distracted by thinking about the food and drink, etc., that are waiting, even if the time for prayer ends. 
But the majority of scholars said that the presence of food that is ready is not an excuse for delaying the prayer, rather that applies when food is ready and the prayer is about to be offered in congregation, i.e., a man is excused from praying in congregation when there is food ready that he wants to eat. So he should eat and then go to the mosque, and if he catches up with the congregation that is fine , otherwise there is no blame on him.  
But this should not become a habit whereby his food is only prepared at the time of prayer, because this means that he is determined not to pray in congregation. However, if this happens coincidentally, then he is excused for not praying in congregation, and he may eat until he is full, because if he eats only one or two mouthfuls he may crave even more for the food. 
This is different from the situation of a man who is starving, when he finds prohibited food such as dead meat. Should we say that if you cannot find anything but dead meat and you fear that you may die or suffer harm, then eat from the dead meat until you are full, or should we say to eat only as much as is necessary? We tell him, eat only as much as is necessary, and if two mouthfuls are enough then do not eat a third. 
Can this ruling on dinner be applied to other things that disturb a person such as needing to urinate, defecate or pass wind ? 
The answer is, yes, this ruling applies in these cases. In the book of Muslim, it is narrated that the Prophet (peace and blessings of Allah be upon him) said: “Do not pray when food is ready or when you are trying to stop yourself from doing either of the two things that break Wudu (i.e., urination and defecation)”
- meaning urination or defecation, and breaking wind is akin to these two.
The basic principle is that everything that may distract a person, keep him from being properly focused in his prayer, or worry him, should be dealt with before he starts to pray.  
This may be summed up by saying: The essence and spirit of prayer is the proper focus of the heart and mind, hence the Prophet (peace and blessings of Allah be upon him) told us to get rid of everything that may prevent that before a person starts to pray.” (Fatawa Al-Shaykh Ibn ‘Uthaymin, 13. question no, 588) 
The Shaykh was also asked: 
If a person needs to urinate but he fears that he will miss the prayer in congregation if he relieves himself, should he pray whilst he is holding it in, so as to be sure of praying with the congregation, or should he relieve himself even if that means missing the congregational prayer? 
He replied: 
“He should relieve himself and do Wudu, even if he misses the prayer in congregation, because this is a valid excuse. The Prophet (peace and blessings of Allah be upon him) said: “Do not pray when food is ready or when you are trying to stop yourself from doing either of the two things that break Wudu (i.e., urination and defecation).” (Fatawa Al-Shaykh Ibn ‘Uthaymin, 13, question, 589)
For more details, please see the following answers: 11591 , 174361 , 2137 , and 26280 . 
And Allah knows best.