An internally generated magnetic field once existed on the Moon. This field reached high intensities (~10-100 μT, perhaps intermittently) from ~4.3-3.6Gyr ago and then weakened to ≲ 5 μT before dissipating by ~1.9-0.8 Gyr ago.While the Moon's metallic core could have generated a magnetic field via a dynamo powered by vigorous convection, models of a core dynamo often fail to explain the observed characteristics of the lunar magnetic field. In particular, the core alone likely may not contain sufficient thermal, chemical, or radiogenic energy to sustain the high-intensity fields for >100 Myr. A recent study by Scheinberg et al. suggested that a dynamo hosted in electrically conductive, molten silicates in a basal magma ocean (BMO) may have produced a strong early field. However, that study did not fully explore the BMO's coupled evolution with the core. Here we show that a coupled BMOcore dynamo driven primarily by inner core growth can explain the timing and staged decline of the lunar magnetic field. We compute the thermochemical evolution of the lunar core with a 1-D, parameterized model tied to extant simulations of mantle evolution and BMO solidification. Our models are most sensitive to four parameters: the abundances of sulfur and potassium in the core, the core's thermal conductivity, and the present-day heat flow across the core-mantle boundary. Our models best match the Moon's magnetic history if the bulk core contains ~6.5-8.5 wt% sulfur, in agreement with seismic structure models.