Respiratory infections 

Dogs may cough and gag due to kennel cough, bronchitis, and pneumonia, which are all common respiratory illnesses. If your dog has recently been around other dogs, it's a good idea to have them checked out by a veterinarian because these infections are frequently shared through contact with other dogs.

Foreign objects 

Dogs occasionally swallow or inhale foreign things like toys, bones, or sticks. As a result, the airway may get blocked, which may result in coughing and gagging. You should seek veterinarian care right away if you suspect your dog may have ingested a foreign object.

Allergies 

Pollen, dust, and mold are among the substances that can cause allergies in dogs. These allergies may irritate the airways, resulting in coughing and gagging. Consult your veterinarian about allergy testing and treatment if you suspect your dog may be allergic to something.

Heart disease 

Dogs who have heart problems may also cough and gag. This is because the heart cannot adequately pump blood, which can cause fluid to accumulate in the lungs. It's crucial to get your dog checked out by a veterinarian right away if you suspect that they may have heart problems.