My daughter has been the same way - great with #1, and longer with #2 to decide that using the potty was the way to go. I figured out some special rewards for going on the potty and if she chose to go in her pants, I told her "Well, now you don't get XYZ...you need to go in the potty to go XYZ." Some of the things we have used include a handful of M&Ms, glo-bracelets (the kind that you have to crack to activate and are super-cheap at the dollar store), and getting her toe nails painted after a bath (not suggesting that to you for your little guy, but you get the idea). She has had some issues with constipation and withholding poop, which made it painful for her to go, further increasing her reluctance to use the potty. I've had to periodically give her Miralax, and really up her fiber intake and decrease her eating of dairy and bananas, to help her along. That would be something to keep in mind that unfortunately can develop if they develop a fear of the potty. I've had to keep a close watch on her because she isn't always great about letting us know she needs to poop and sometimes when I notice that she is getting that "look" on her face or suddenly decides she wants to hide in her room with the door closed, I lead her over the potty, make her sit on it for a few minutes, and remind her of what she supposed to do. So some careful observation may be in order.
One friend of mine got her 4 year old to go poop on the potty by not letting him play the Wii each day until he pooped. It worked for them because he was just plain stubborn about it - he's the kind of kid that automatically says no or "why?" initially to whatever you want him to do. So whenever he got up in the morning and wanted to play on the Wii, his mom told him he couldn't until he went poop. He was mad about it for about 2 or 3 days before he finally gave in, and then everything was fine.