The more you cough, the more you have to cough. It's insidious. My weapon of choice in controlling and eventually getting rid of it is Robitussin-D, or store brand equivalents (CVS's Tussin-D, etc.).
There are different varieties for different kinds of cough needs, but for me, "D" first and foremost gets the constant hacking under control, while making the coughs more productive so you get rid of crap. I follow dosage instructions, and the important thing is to keep it going until you're truly rid of the cough.