There are several possibilities here.
The first is that you are not staying well hydrated between and during runs or work outs. This could lead to thick mucus. The solution to this is to drink plenty of water all the time, not just when you are running. Other strategies that work for some athletes include carrying water with them when they are working out that they can swish around their mouth and swallow in small quantities or chewing gum.
Another possibility is that you are simply working out too hard. You may want to try backing off on the intensity and seeing if the problem resolves; then you can resume training with a more gradual buildup of intensity over time.
Next, it is possible that your suffering from allergies or exercise induced asthma
. Both of these problems could lead to choking, gagging, coughing, or wheezing while exercising.
I strongly recommend that you get in to see your primary care doctor
about this issue. They will be able to examine you and ask a few questions and, with this information, at least rule out that you are dealing with asthma or allergies. This is an important thing to find out, as there are very effective medications to control these two problems.