An imbalance in the colonic microbiota might underlie many human diseases, but the mechanisms that maintain homeostasis remain elusive. Recent insights suggest that colonocyte metabolism functions as a control switch, mediating a shift between homeostatic and dysbiotic communities. During homeostasis, colonocyte metabolism is directed toward oxidative phosphorylation, resulting in high epithelial oxygen consumption. The consequent epithelial hypoxia helps to maintain a microbial community dominated by obligate anaerobic bacteria, which provide benefit by converting fiber into fermentation products absorbed by the host. Conditions that alter the metabolism of the colonic epithelium increase epithelial oxygenation, thereby driving an expansion of facultative anaerobic bacteria, a hallmark of dysbiosis in the colon. Enteric pathogens subvert colonocyte metabolism to escape niche protection conferred by the gut microbiota. The reverse strategy, a metabolic reprogramming to restore colonocyte hypoxia, represents a promising new therapeutic approach for rebalancing the colonic microbiota in a broad spectrum of human diseases.