It is most likely you have over carbonated the beer. When the beer is in the keg it is in equilibrium with the pressure, when you dispense you are exposing it to atmospheric pressure which causes the absorbed gas to expand and be liberated. So you need to reduce the pressure in your keg. Turn off your gas supply then burp your keg (lift the safety valve) to release the pressure. Note the pressure reading after doing this and leave it for a day. The pressure should rise in the keg as the excess gas comes out of the beer and fills the keg. Turn the gas back on, set at 10 or 12 psi then see how you go, may need to do this several times. This will improve as the keg gets emptier as the head space increases. Also make sure when using the gun you gully depress the handle, don't try to make it come out slow. If you want it slow, reduce gas pressure, burp, then pour.
Cheers