A balanced gut microbiota is important for human health, but the mechanisms that maintain homeostasis are incompletely understood. Recent insights suggest the host plays a key role in shaping its gut microbiota to be beneficial. While host control in the small intestine curbs bacterial numbers to avoid competition for simple sugars and amino acids, the host limits oxygen availability in the large intestine to obtain microbial fermentation products from fiber. Epithelial cells are major players in imposing ecological control mechanisms, which involves the release of antimicrobial peptides by small-intestinal Paneth cells and maintenance of luminal anaerobiosis by epithelial hypoxia in the colon. Harnessing these epithelial control mechanisms for therapeutic means could provide a novel lynchpin for strategies to remediate dysbiosis.