Take each of the following steps that you haven't already tried.
1. Start with the steps recommended in this support article.
2. If your model has an audio-out (headphone) port, and a red light is coming from it, the internal switch is stuck in the position for digital output. You may be able to free it by inserting and removing a mini-stereo jack of the proper size. Inserting any kind of tool in the port may cause damage that won't be covered by your warranty.
If there's no red light, the switch may still be stuck in the headphone position. Try to free it the same way.
3. Boot in safe mode. Don't log in; just reboot as usual when the login screen appears. When you do, make sure the words "Safe Boot" do not appear in the login screen. If they do, the system is still in safe mode and sound won't work.
4. Reset the NVRAM.
5. Reset the SMC.
6. Reinstall OS X after backing up all data.
7. Make a "Genius" appointment at an Apple Store.