The Barstow Formation (ca. 19–13 Ma) of southern California, USA, is a terrestrial sequence known for its diverse Miocene mammalian faunas. The formation spans the Middle Miocene Climatic Optimum (MMCO; 17–14 Ma) and offers the opportunity to study environmental change during the last major interval of global warming of the Cenozoic. We combined isotopic analyses of carbon and hydrogen from sedimentary n-alkanes and bulk soil organic matter with analysis of phytoliths (plant silica) and diatoms to reconstruct vegetation composition, habitat structure, and moisture dynamics through the formation. The δ13C and δD of long-carbon-chain n-alkanes derived from terrestrial plants and preserved in sediments of the Barstow Formation record drying prior to the MMCO and through the Middle Miocene Climatic Transition (MMCT; beginning ca. 14 Ma), punctuated by increased moisture in fluvial environments during the peak of the MMCO. Variable isotopic results relate to changes in moisture, driven partly by facies, vegetation composition, tectonic activity, and climatic variability coinciding with intervals of high pCO2. Phytolith assemblages are dominated by forest indicators in riparian habitats during the MMCO, and grass morphotypes constitute significant components of phytolith assemblages after the MMCO, indicating a shift to drier, more open-canopy habitats. The establishment of dry, wooded grasslands in the Barstow Basin coincides with the beginning of the MMCT and cooling sea-surface temperatures in the Pacific Ocean. Our results indicate that moist, closed-canopy habitats formed in southern California during climatic warming, followed by savannah during climatic cooling and the shift to seasonal precipitation regimes.