Babies swallow air while breastfeeding or bottle-feeding. The baby gets rid of the swallowed air by passing gas or burping. In order to get rid of the gas your baby swallows and to comfort it you can try the following:
Hold your baby from its bottom, lean it toward yourself in a way its head comes up to your shoulder. Pat your baby gently and rhythmically on its back.
Lay the baby down on its back on your knees and pat it gently on its back to relieve your baby.
After your baby is 3 months old, you can sit it on your knees, hold it from its chest with one hand and help your baby get rid of the gas by patting gently on its back with your other hand.