Reverse sneezing or Pharyngeal gag reflex to give it its proper name, is an involuntary thing dogs and even cats do.
It does not occur very often which is why most humans that have not seen it before may find it distressing to watch, especially if they have never seen a reverse sneeze before.
A reverse sneeze is very sudden, explosive and accompanied by a lot of loud snorting and snuffling which is why it gets the more common name of reverse sneezing.
The main reason for it is an irritation to the soft palate or throat.
You may see your humans doing this when they have a sudden coughing fit for no reason. It is similar except we have a much more dramatic and loud reaction.
Causes of reverse sneezing could be eating or drinking too quickly, rushing around and getting too excited, dust or pollen or in my case lying down in a sort of failed flat pack position that restricts the airflow a little bit too much.
Still talking about normally healthy dogs, this is more often associated with short faced animals, although if you are a pointy nosed sighthound like me you will be very used to reverse sneezing.
You need to explain to your humans how to help, not that help is always needed, but it makes the humans feel more comforted at the time. Tell them to raise your head and open your mouth to allow more air in, or gently hold your nostrils for a few seconds which will cause you to open your mouth and allow more air in. Or just gently rub your throat from the jaw downwards.
In most cases reverse sneezing does not require medical assistance but if you are a dog or cat that has a medical condition, especially a respiratory condition reverse sneezing may be more that just an isolated event.
If at any time your human is not sure or is concerned then please tell them to seek advice from your veterinarian.