This is not a new thread, and has been replied to more than 4000 times, so I have no doubt I am saying the same things others have, but I will nonetheless include my own experiences here.
I just came online to this site, to check out the threads and see if there were common problems, and it seems there are. Until last night, to my knowledge, I had no trouble with speaker sound, but suddenly today when I turned the switch for speakers on nothing comes out. Tried music, tried games... nothing. I plug in the headphones and I have sound.
Now, I suspect this is a software problem or some simple little thing, and the reason I say this is because when I tested Siri the voice came out no trouble at all. Asked her how she was doing and she said she was just fine, and that resonated in the voice -- so not hardware, per se. I then checked for the sound you get when you plug in the power and got that too, so again, not hardware methinks. The last thing I did last night with my iPhone was take a call while I was out walking and I used the speaker on the headphones. Without going into detail it was a heated call and the person hung up on me, with me hitting buttons on my screen. I suspect one of one of two things, if not hardware:
1. The phone suspects the headphones are still plugged in (but then why would Siri work?).
2. I hit mute during the call and can't find a way to turn it off short of calling someone, which I should probably do.
We'll see if this helps. I can tell you that if you have the same problem and no Apple Care you're likely SOL.