Try launching Apple's GarageBand application to fix it or (try) launching then quitting the "Audio MIDI Setup" application located in Applications/Utilities(*).
(I'm not certain of this quote's source or accuracy: "One important thing about that; you have to run a Garage Band file, not just open the program. How to do this... to create a file open Garage Band, click on New Music Project, save the project as "My Song" click the red record button in the controls at the botttom, click on the keyboard and do random notes; no talent nessacary. Save this as My Song , and you will have your debuging tool. Open this file and play it if you experience the loss of sound problems described in this and other threads.")
(*)Loss of internal speakers: This issue can sometimes be resolved by opening the Audio MIDI Setup application (located in Applications/Utilities) and changing the output setting to 44 KHz (44100.0 Hz) in both the Built in output window AND the Audio Output window.