What could be causing me to cough up yellow mucus for more than 2 weeks?

Possibilities.... Possible causes of this cough include acute bronchitis from either a viral or bacterial cause, especially if the cough is improving. If it is not improving, possible causes include bronchospasm from any cause, gerd, post-nasal drip or a combination of factors. If you smoke, you need to quit to decrease airway inflammation. See your doctor for diagnosis and treatment.