We develop a model describing the buoyancy-driven propagation of two-phase gravity currents, motivated by problems in groundwater hydrology and geological storage of carbon dioxide (CO2). In these settings, fluid invades a porous medium saturated with an immiscible second fluid of different density and viscosity. The action of capillary forces in the porous medium results in spatial variations of the saturation of the two fluids. Here, we consider the propagation of fluid in a semi-infinite porous medium across a horizontal, impermeable boundary. In such systems, once the aspect ratio is large, fluid flow is mainly horizontal and the local saturation is determined by the vertical balance between capillary and gravitational forces. Gradients in the hydrostatic pressure along the current drive fluid flow in proportion to the saturation-dependent relative permeabilities, thus determining the shape and dynamics of two-phase currents. The resulting two-phase gravity current model is attractive because the formalism captures the essential macroscopic physics of multiphase flow in porous media. Residual trapping of CO2 by capillary forces is one of the key mechanisms that can permanently immobilize CO2 in the societally important example of geological CO2 sequestration. The magnitude of residual trapping is set by the areal extent and saturation distribution within the current, both of which are predicted by the two-phase gravity current model. Hence the magnitude of residual trapping during the post-injection buoyant rise of CO2 can be estimated quantitatively. We show that residual trapping increases in the presence of a capillary fringe, despite the decrease in average saturation.