Feb 13, 2020 · To prevent excess gas, it may help to: Eliminate certain foods. Common gas-causing offenders include beans, peas, lentils, cabbage, onions, broccoli, cauliflower, whole-grain foods, mushrooms, certain fruits, and beer and other carbonated drinks. Try removing one food at a time to see if your gas improves. Read labels.