The behaviour of a gravity current propagating into a two-layer stratified ambient fluid is described in detail. A comprehensive description is given of the different flow regimes, with particular emphasis on the front condition linking the thickness of the gravity current to its speed of propagation and the transfer of energy to upstream disturbances in the form of internal bores and nonlinear solitary waves. Hydraulic theory analogous to that of two-layer flow over topography (Baines, J. Fluid Mech., vol. 146, 1984, pp. 127–167) is extended to the gravity current problem to classify frontal behaviour into the following regimes: Type I, subcritical currents; Type II, currents that generate upstream undular bores; Type III, currents that generate an upstream monotonic bore connected by a rarefaction; Type IV, supercritical fronts with a large-amplitude trapped solitary-wave-like disturbance; and Type V, supercritical gravity currents. Over 200 two-dimensional Boussinesq–Euler simulations spanning a range of gravity current properties demonstrate good agreement, for both the behavioural regime and the front condition , with hydraulic theory that extends original work by Rottman & Simpson (Q. J. R. Meteorol. Soc., vol. 115, 1989, pp. 941–963) to arbitrary ambient layer thickness, and uses an improved closure for the upstream bore that correctly predicts the behaviour in the limit of large bore amplitude. In addition, the energy balance is analysed, and it is shown that the energy transfer from the gravity current to upstream disturbances is significant, and consistent with the hydraulic theory. The results demonstrate a clear connection to the problem of upstream resonance in two-layer flow over topography, and have significant implications for interpreting field observations of nonlinear internal waves generated by atmospheric density currents and coastal river plumes.