Try any of the following:
1. Make sure the headphone plug is fully inserted into the headphone jack.
2. Make sure dust or debris is not causing the contact to register.
3. Try a different pair of headphones.
4. Make a Genius Bar appointment with the nearest Apple Store to have them diagnose and fix the problem for you.