Your baby seems to be developing constipation which may be due to a variety of reasons such as:
1) Change in diet... Usually occurs when children are given high fat milk.
2) Anal fissure
3) Small anal orifice
4) Certain diseases of the colon like Hirschsprungs disease
5) Hypothyroidism etc....
To manage the current situation, start the following medications:
1) Liquid Lactulose, 2.5ml twice a day for at least 1 week.
2) Glycerine suppository to be inserted in the rectum of the baby at bed time.
Next Steps
In case you are giving the baby top feeds, please shift back to breastfeeding only. your baby should not be on any other milk except for mother's milk at this age. If the breast feed is inadequate, feed the baby skimmed milk or age appropriate formula feed as available in the market.
Look for any sign of bleeding in the stools or any mass protruding from the anus.
If the constipation is not relieved in the next 2 days, or if the baby develops abdominal distension and vomiting, please take your baby to a doctor. He may need further evaluation.