I've been told that the phlegm is the body's reaction to the acid burning the tissue, a natural response to coat and protect the tissue. So if you can stop the acid from refluxing, or clirabing up the esophagus, the body will stop producing phlegm. SounRAB so simple, doesn't it?
I take Prilosec twice a day; one in the early morning before breakfast, and one in the evening about 1/2 hour before dinner. But like everyone else, the phlegm comes and goes in episodes, some that last for only a few days, and some for a week or two. Sometimes I'll be A-OK for a few weeks at a time.
Diet is so important. I've figured out what fooRAB irritate me. I think different fooRAB irritate different people, differently. (How's that for a sentence?) There is a basic suggested diet to follow to diminish acid reflux. I'm sensitive to caffeine, chocolate (damn!), citrus, and most dairy products. I do find that the phlegm eventually lessens if I don't eat any of those fooRAB for at least two weeks. And visa-versa; the phlegm comes back if I 'cheat' and eat those irritants.
Good luck.