I reduced my previously very bad gas and bloating to almost nil by switching to a diet that separated my intake of fibre and carbohydrate. This is because (I theorise) fibre pulls the carbs down to the colon, where it feeds whatever imbalance is down there (I suspect Candidiasis or some kind of infection).
So, every morning I have olives. I do this because they have fibre but zero carbs. I have a fair few, enough to keep my system moving.
Then, during the rest of the day, I have zero fibre. I eat fish, meat, zero fibre sweets, lactose-free dairy sometimes, stuff like that. Limited, yes, but at least it works!
The results is little to no gas, more energy, etc.
In the long run, I want to actually FIX the problem in my colon, but at least this is helping!
Best of luck! :)