Why did the sound suddenly stop working on my iPhone?

About a week ago while I was playing music on my phone, the sound just suddenly stopped working. I get no sound when I receive calls, play games, get notifications, etc. When I plug the headphones in, I get sound from them. It's almost as if they are stuck in headphone mode. I haven't gotten my phone wet or dropped it, nothing has been done to damage it. Yet it is without sound. Any ideas on what happen or what I can do to fix it?

iPhone 3GS

Did you try turning you iPhone off and on?

You can do this by holding the lock button.