Try resetting the SMC. To do that shut down the computer. Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected. On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time. Release all the keys and the power button at the same time. Press the power button to turn on the computer. The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.
I had an issue with low sound on my mac pro and a reset did the trick.
Also try a PRAM reset by restarting your Mac while holding down Command, Option, P, and R. Keep holding them down until the computer starts and chimes. Keep them held down until it chimes again, then release the keys.
If all that fails, it could be the sensor inside the headphone jack is dirty or messed up. The sensor is a switch responsible for switching between something plugged into the headphone jack and the internal speakers. It can be cleaned using an electronic foam swab and rubbing alcohol or try a tooth pick and compressed air. Hopefully the switch is not dying.
Lisa