I had this problem with my Kaitlynn. I eventually gave up breastfeeding after 2 months because my diet had become so restricted that I thought I might go crazy. Good for you if you stick with breastfeeding, though. Some babies, no matter what you do to change your diet or their formula, still suffer with painful gas for the first 6 months and you just have to find ways to cope with it.
One thing that helped with her though was to recognize if she was really hungry or if she just wanted to suck. There is a reason for pacifiers--not everybody likes them, but they can be very helpful. Kaitlynn wanted to suck all the time she was awake (and asleep) and I found if I let her breastfeed or bottlefeed all the time like that she was puking and a lot more gassy. If your baby has just breastfeed for over a half hour and still wants to suck (after your milk supply is well established) try a pacifier.
Here's some other things that haven't been mentioned:
Put him belly down across your legs, with your legs together, sway your legs back and forth, and rub or pat his back. The pressure on his belly help relieve the gas and the swaying and rubbing/patting help to calm him. You might find him falling asleep a lot this way--I know Kaitlynn did almost every time I did this.
During her colicky period, sleeping on her tummy was the only way anybody got any sleep in this house. I know what they say about the risk of SIDS being higher when babies are put to sleep on their tummies, so this is something to be very careful about. If you decide to do this, only put him to sleep on a very firm surface and make sure that nothing will get in the way of his airways. Kaitlynn is 5 months now and sleeps very well on her back and even rolls onto her side as she sleeps now.
Warm water. If you are pumping occasionally or are going to start pumping soon, you can give your baby some warm water in the bottles you plan on giving him your pumped breastmilk in. Warm water is a great gas reliever.
Burping. Make sure to stop breastfeeding or bottlefeeding every 5 to 10 minutes to burp your child. I know it's an obvious thing, but it bears repeating.
Belly rubs and leg exercises also help relieve baby's gas.
Slow dancing and singing or humming to your baby while rubbing or patting his back are great soothers and when baby is calmed down, it's easier to get those burps up.
Gripe water, like a few other people have already mentioned, is liquid gold. There were days that nothing worked with Kaitlynn and neither her nor me had slept all night or day and giving her a little bit of this magical little potion put her out of her poor little gassy misery and straight to sleep. Heaven for both of us.

Good luck! I'm wishing you and your baby to lots of restful nights and peaceful days soon!