This happens when your keg is really full and you have pressure in the keg that is higher than the pressure coming out of the regulator. The only sure fire way to prevent this is with a check valve in the gas line, ideally located near the gas inlet fitting on the keg. Most regulators come with a ball valve that has a built in check valve, the problem is that beer can still back up a little because there is a lot of dead space in the line prior to the check valve. The other thing you can do is always make sure your tank valve is on before hooking up the gas, and also, pull the pressure release valve on the keg to make sure that the keg pressure is below the regulator pressure. You want gas moving toward the keg, never the other way around.
How to clean? Another reason I absolutely detest barb fittings. You will have to rinse out the lines somehow, and that usually involves detaching the barbs, cleaning the hose, then reinstalling. There are better ways than barbs, I'd be happy to fill you in.