I was having this problem too and until a few days ago had eliminated cow's milk from my diet (a total bummer, being veg!) Here's what I found, is that in my case, I have oversupply, so now I just nurse on one boob until it is finished (this can take a couple feedings)--that way he is getting the hindmilk, containing lactase which breaks down the lactose in the foremilk. (The lactose in the foremilk can cause real gas problems if the baby doesn't get enough of the hindmilk to break it down--making the baby seem lactose intolerant, even though he isn't.) My baby didn't have any signs of a milk allergy other than gas--no rashes, eczema, etc. One thing that tipped me off to this was that my baby gained 1 pound between 3 and 10 days old. The protein of the foremilk made him do it! His pedi was really amazed.Then I read that babies who get an inbalance of milk tend to gain a crazy amount of weight. I've re-added the milk (and haven't restricted it either) and there's no problem/difference.
Another thing: my baby still often cries when he's trying to poop it, and that is because of all things, (I read in many sources) he hasn't figured out that he shouldn't tense his rectal muscles and try to push at the same time. Ouch! They learn that eventually (of course) but in the meantime it hurts. I know it doesn't ALWAYS hurt him to poo because many times he just does it without thinking. Only when he is focusing on it! I distract him when he is pooping and that sometimes works, but sometimes he just needs to suss it out for himself.
I tried mylicon drops, Hyland's colic tablets and gripe water in the beginning (I'm talking like he's 25 years old now, I realize, but when he was really crying a lot it felt like it had been that long!) and the only thing I noticed did ANYTHING was that the camomile in the Hyland's put him to sleep. But so does the white noise of static radio (as recommended in The Happiest Baby on the Block--my new fave book) and costs nothing. Much of what I thought was gas making him cry was also I think that I was sitting around too much and he needed to be bounced and walked more. Now that I am able to be more active, he's much, much happier. Course it's raining today, so no walk.