Is he having a bowel movement every day, just not on the toilet?
If he's not having a bowel movement then he could be anal retentive which can cause your colon to expand until it hurts really bad when you finally do go, making the experience worse. This happened with my three year old and we had to put her on Myralax for awhile until she got in to the habit of going every day and they were small enough to pass without hurting.
If however, he is using his underwear then its a different matter all together. You might want to put him back in pull ups if thats what it takes to get the message across. Saving things he likes-like playing computer games, watching a show, etc until after he has a bowel movement in the toilet. This way, its not really a prize, but rather something he normally gets to do and *likes* that he wont be allowed to do until he starts going in the toilet. And it never hurts to get a second opinion from another doctor. There might be something psychological that could be easily remedied with the right steps.
I hope either of these suggestions helped you.