How old is he?
Does it happen more at night or no difference throughout the day?
Does anything come up like phlegm?
Does it sound like a cough/gag or could it be more of a snorting sound?
Toy poodles commonly have a condition called a collapsing trachea. This is a very common cause to chronic cough in this breed. Discuss this possibilty with your veterinarian. In this condition an area of the trachea (wind pipe) is weakened and it literally collapses on itself making it difficult for air to pass result in a coughing/gagging sound. Pressure on the throat with a collar and lead can worsen this condition when walking. Many small breed dogs suffer from this condition that may be related to an enlarged heart. Medications like torbutrol and aminophylline can bring relief and prevent attacks. If your dog is a candidate surgery may be an option. X-rays and physical exam can help to rule out this condition. It isn't always detectable on xray but may be able to be detected by palpation on the throat.
You may also be having issues with a reverse sneeze. Sometimes this is triggered by post nasal drip or secretions from the sinuses running down the back of the throat usually the result of an allergy. Basically instead of air being forced outward the dog continues to suck air in in a snorting sort of manner then a gag following trying to remove the mucous. Click this link for more information: Reverse Sneeze
Though the cause can be controversial many times this can be associated with allergies. Benedryl is fine but must be given long term and not all dogs get a great response with it. There are a number of other antihistamines that can be tried to help relieve allergy symptoms. Your dogs may benefit from Atarax (hydroxyzine) as it is a stronger antihistamine. Clemastine is another. Because of the possible inflammation from the chronic allergies a short run on a low dose steroid may prove beneficial. In your dogs case with both the sneeze and cough temaril-p would be a good alternative to the benedryl for now. This medication helps to control allergies, cough, and inflammation.
Check out this site, it discusses both reverse sneezing and tracheal collapse:
Please let me know if further assistance is needed.
Those are the more important issues. I will reiterate the possibilities of allergies playing a role in this and post nasal drip. Another thing to consider are issues with the teeth, gingivitis, and infection causing a chronic throat irritation as a result of constantly swallowing bacteria. Lastly, inconsistency in thyroid medication can cause issues with laryngeal paralysis. This is or can be a symptom of hypothyroidism. I would definitely give this to him at the recommended dosing schedule and consider an antihistamine to control allergies. Benedryl can be given at a dose of 1mg per pound up to three times daily. This too must be given regularly. See how he does and if the gagging subsides. Otherwise he may need to go in for a dental exam.