Asthma is prevalent in Western countries, and recent explanations have evoked the actions of the gut microbiota. Here we show that feeding mice a high-fibre diet yields a distinctive gut microbiota, which increases the levels of the short-chain fatty acid, acetate. High-fibre or acetate-feeding led to marked suppression of allergic airways disease (AAD, a model for human asthma), by enhancing T-regulatory cell numbers and function. Acetate increases acetylation at the Foxp3 promoter, likely through HDAC9 inhibition. Epigenetic effects of fibre/acetate in adult mice led us to examine the influence of maternal intake of fibre/acetate. High-fibre/acetate feeding of pregnant mice imparts on their adult offspring an inability to develop robust AAD. High fibre/acetate suppresses expression of certain genes in the mouse fetal lung linked to both human asthma and mouse AAD. Thus, diet acting on the gut microbiota profoundly influences airway responses, and may represent an approach to prevent asthma, including during pregnancy.