Go step by step and test.
1.Plug in and remove the headphone.
If you see red light in the headphone port, plug the headphone
in and out of the port 5 or 6 times to flip the microswitch inside.
Sound output may be stuck in the digital mode.
Try this even if you don’t see the red light.
2. Reset SMC.
Choose the method for “On Mac notebooks with non-removable battery”.
https://support.apple.com/en-us/HT201295
3. Reset PRAM. http://support.apple.com/kb/PH18761
4. Applications > Utilities > Audio MIDI Setup
Audio Devices window
Side Bar
Click the Built-in Output.
Under Mute any of the boxes checked? If so, uncheck it.
Make sure that CH1 and CH2 volume sliders are at the middle and matched.
5. System Preferences > Sound> Sound Effects
Play sound effects through:
Select "Internal speakers" and then back to "Selected sound output device".