I used to get into this position my bed on my knees, head on the mattress, sometimes just on my forearms, the lower I got(if that makes sense)seemed to help.
Let me know if I sound confusing π
The only thing I take is to MAKE me have gas... Lol sorry that doesn't help at all, and it is embarrassing at the wrong time but personally I don't think you should try and prevent it. It is normal and good to get it out.