Type 1 diabetes (T1D) is a debilitating autoimmune disease that results from T-cell-mediated destruction of insulin-producing β-cells. Its incidence has increased during the past several decades in developed countries, suggesting that changes in the environment (including the human microbial environment) may influence disease pathogenesis. The incidence of spontaneous T1D in non-obese diabetic (NOD) mice can be affected by the microbial environment in the animal housing facility or by exposure to microbial stimuli, such as injection with mycobacteria or various microbial products. Here we show that specific pathogen-free NOD mice lacking MyD88 protein (an adaptor for multiple innate immune receptors that recognize microbial stimuli) do not develop T1D. The effect is dependent on commensal microbes because germ-free MyD88-negative NOD mice develop robust diabetes, whereas colonization of these germ-free MyD88-negative NOD mice with a defined microbial consortium (representing bacterial phyla normally present in human gut) attenuates T1D. We also find that MyD88 deficiency changes the composition of the distal gut microbiota, and that exposure to the microbiota of specific pathogen-free MyD88-negative NOD donors attenuates T1D in germ-free NOD recipients. Together, these findings indicate that interaction of the intestinal microbes with the innate immune system is a critical epigenetic factor modifying T1D predisposition.