I have a MacBook Pro and I often encounter this issue: when I put the laptop to hibernate, and then when I reopen the lid, I can not hear any sound.

Later I found this post, which indicates that this is not a hardware issue, but a bug of MacOS of coreaudiod. There are several ways to solve it:

• open activity monitor, search audio and find coreaudiod, exit from it, and it will restart.
• another way is to enter sudo killall coreaudiod in the terminal, or replug in the earphone.
• restart is also an option.