I can't address gaining weight problems, but I can address malabsorption problems. No one should have gas and bloating after eating. Try taking some really good digestive enzymes with each meal, and take acidophilus if you have any smell to the gas or to your stools. Gaining weight or not, your food is not doing you any good if it is not being absorbed.
Try 5-6 caps of acidophilus per day until the odor goes away from your stool, then cut back to 1-2 a day. You may get loose stools, but you can play with the dosage. Ask your HFS to recommend a good digestive enzyme. If there is cancer in your family, take it between meals too.
Overeating will only put a load on an already overloaded digestive system. Work on that first.
If these two things don't give your relief, try changing your diet dramatically. For example, if you are vegetarian, go on protein and vegetables, including meat. If you are eating protein and vegetables including meat, try fruit. If you are eating grains, stop. And so on. Maybe keep a journal as to what gives you gas. It may not be so simple as eat more, eat less. Gaining weight should be a secondary goal to vibrant health.