Gas exsolution and segregation are fundamental controls on eruption dynamics and magma genesis. Basaltic magma loses gas relatively easily because of its low viscosity. However, bubbles grown by decompression and diffusion during magma ascent are too small to segregate. Coalescence, however, can create bubbles big enough for gas to escape from the rising basalt magma. In evolved magmas, such as andesite and rhyolite, high viscosity prevents bubbles rising independently through the magma. The original gas content of magma erupted as lava is commonly the same as that erupted explosively, so that a gas separation mechanism is required. A permeable magma foam can form to allow gas escape once bubbles become interconnected. Magma permeabilities can be much higher than wall-rock permeabilities, and so vertical gas loss can be an important escape path, in addition to gas loss through the conduit walls. This inference is consistent with observations from the Soufrière Hills Volcano, Montserrat, where gas escapes directly from the dome, and particularly along shear zones (faults) related to the conduit wall. Dynamical models of magma ascent have been developed which incorporate gas escape. The magma ascent rate is sensitive to gas escape, as the volume proportion of gas affects density, magma compressibility and rheology, resulting in both horizontal and vertical pressure gradients in the magma column to allow gas escape. Slight changes in gas loss can make the difference between explosive and effusive eruption, and multiple steady-state flow states can exist. In certain circumstances, there can be abrupt jumps between effusive and explosive activity. Overpressures develop in the ascending magma, caused primarily by the rheological stiffening of magma as gas exsolves and crystals grow. A maximum overpressure develops in the upper parts of volcanic conduits. The overpressure is typically several MPa and increases as permeability decreases. Thus, the possibility of reaching conditions for explosions increases as permeability decreases, both due to overpressure increase and the retention of more gas. Models of magma ascent from an elastic magma chamber, combined with concepts of permeability and overpressure linked to degassing, provide an explanation for the periodic patterns of dome growth with short-lived explosive activity, as in the 1980-1986 activity of Mount St Helens. Degassing of magma in conduits can also cause strong convective circulation between deep magma reservoirs and the Earth's surface. Such circulation not only allows degassing to occur from deep reservoirs, but may also be a significant driving force for crystal differentiation.