Circuit-based quantum devices rely on keeping electrons at millikelvin temperatures. Improved coherence and sensitivity as well as discovering new physical phenomena motivate pursuing ever lower electron temperatures, accessible using on-chip cooling techniques. Here we show that a two-dimensional electron gas (2DEG), with the sub-band populations manipulated using gate voltages, works as an on-chip cooler only limited by a fundamental phonon heat leak. The 2DEG can, for example, be realized in a silicon-based double-gate complementary metal oxide semiconductor (CMOS) transistor. A single-shot 2DEG cooler can reduce the electron temperature by a factor of 2 with a hold time up to a second, achieved by expanding the electron gas into an additional sub-band. Integrating an array of such coolers—using, e.g., CMOS fabrication techniques—to obtain continuous cooldown may allow reaching down to microkelvin device temperatures.