Clay minerals provide indicators of the evolution of aqueous conditions and possible habitats for life on ancient Mars. Analyses by the Mars Science Laboratory rover Curiosity show that ~3.5-billion year (Ga) fluvio-lacustrine mudstones in Gale crater contain up to ~28 weight % (wt %) clay minerals. We demonstrate that the species of clay minerals deduced from x-ray diffraction and evolved gas analysis show a strong paleoenvironmental dependency. While perennial lake mudstones are characterized by Fe-saponite, we find that stratigraphic intervals associated with episodic lake drying contain Al-rich, Fe3+-bearing dioctahedral smectite, with minor (3 wt %) quantities of ferripyrophyllite, interpreted as wind-blown detritus, found in candidate aeolian deposits. Our results suggest that dioctahedral smectite formed via near-surface chemical weathering driven by fluctuations in lake level and atmospheric infiltration, a process leading to the redistribution of nutrients and potentially influencing the cycling of gases that help regulate climate.