This happened to me once... I reseted it(Hold the home and the unlock button on top for a couple of seconds) and it worked fine.
Happened to me...had to reinsert the headphones, listened to music for a second and then unplugged. Sound was working fine after that. So far it has been just a one time occurrence.If you have used the earphones or anything else in the earphone jack there is a chance that the switch that turns off the phone sound is stuck. Plug the earphones in and out of the jack and see if you can free up the switch.