Mother's diet is one main reason for gas in babies. Avoid foods that are gassy, also avoid hard foods for 6 months. Have garlic and ginger regularly in your diet.
For baby, you can give gastica
If baby has constipation or doesn't poop regularly also accumulate gas, give raisin water in low quantity, then increase gradually depending on pooping.
Oil massage also helps in relieving gas.
Feeding after long gap also causes gas so feed regularly even when sleeping.