The incidence of autoimmune diseases has been steadily rising. Concomitantly, the incidence of most infectious diseases has declined. This observation gave rise to the hygiene hypothesis, which postulates that a reduction in the frequency of infections contributes directly to the increase in the frequency of autoimmune and allergic diseases. This hypothesis is supported by robust epidemiological data, but the underlying mechanisms are unclear. Pathogens are known to be important, as autoimmune disease is prevented in various experimental models by infection with different bacteria, viruses and parasites. Gut commensal bacteria also play an important role: dysbiosis of the gut flora is observed in patients with autoimmune diseases, although the causal relationship with the occurrence of autoimmune diseases has not been established. Both pathogens and commensals act by stimulating immunoregulatory pathways. Here, I discuss the importance of innate immune receptors, in particular Toll-like receptors, in mediating the protective effect of pathogens and commensals on autoimmunity.