I have very limited knowledge on the subject, but basically gas is caused by irritation in the intestinal tract.
Things that can cause gas are foods that are flautulent like just about all kinds of beans. I know that too much onion can cause gas. Also foods that have a high fiber content -- if you cut back on the ingestion of fiberous foods like broccoli and such, this might help.
What gives me immediate relief is I take some Pepto-Bismo which soothes the lining of the stomach and intestines and it seems to relieve the gas and bloating. Everybody is different.
Also, I think that over-eating or mixing lots of different types of foods that shouldn't go together encourges gas. I think that over-drinking sometimes irritates the stomach or interferes with digestion -- I suppose that might be a factor too.
I think in general though, gas is related to over-indulgences. But that's my non-expert opinion, based on personal experience and some things I've read.
Hope that helps.