Growing up on a dairy farm protects children from allergy, hay fever, and asthma. A mechanism linking exposure to this endotoxin (bacterial lipopolysaccharide)–rich environment with protection has remained elusive. Here we show that chronic exposure to low-dose endotoxin or farm dust protects mice from developing house dust mite (HDM)–induced asthma. Endotoxin reduced epithelial cell cytokines that activate dendritic cells (DCs), thus suppressing type2 immunity to HDMs. Loss of the ubiquitin-modifying enzyme A20 in lung epithelium abolished the protective effect. A single-nucleotide polymorphism in the gene encoding A20 was associated with allergy and asthma risk in children growing up on farms. Thus, the farming environment protects from allergy by modifying the communication between barrier epithelial cells and DCs through A20 induction.