Objective: Changes in the microbiota (dysbiosis) were suggested to increase the risk of several psychiatric conditions through neurologic, metabolic, and immunologic pathways. Our aim was to assess whether exposure to specific antibiotic groups increases the risk for depression, anxiety, or psychosis. Method: We conducted 3 nested case-control studies during the years 1995-2013 using a large population-based medical record database from the United Kingdom. The study included 202,974 patients with depression, 14,570 with anxiety, and 2,690 with psychosis and 803,961, 57,862, and 10,644 matched controls, respectively. Cases were defined as individuals aged 15-65 years with any medical Read code for depression, anxiety, or psychosis. Subjects with diagnosis-specific psychotropic prescriptions > 90 days before index date were excluded. For every case, 4 controls were selected using incidence density sampling, matching on age, sex, practice site, calendar time, and duration of follow-up before index date. The primary exposure of interest was therapy with 1 of 7 antibiotic classes > 1 year before index date. Odds ratios (ORs) and 95% CIs were calculated for the association between each psychiatric disorder and exposure to individual classes of antibiotics using conditional logistic regression analysis. The risk was adjusted for obesity, smoking history, alcohol consumption, socioeconomic status, and number of infectious events before diagnosis. Results: Treatment with a single antibiotic course was associated with higher risk for depression with all antibiotic groups, with an adjusted OR (AOR) of 1.23 for penicillins (95% CI, 1.18-1.29) and 1.25 (95% CI, 1.15-1.35) for quinolones. The risk increased with recurrent antibiotic exposures to 1.40 (95% CI, 1.35-1.46) and 1.56 (95% CI, 1.46-1.65) for 2-5 and > 5 courses of penicillin, respectively. Similar association was observed for anxiety and was most prominent with exposures to penicillins and sulfonamides, with an AOR of 1.17 (95% CI, 1.01-1.36) for a single course of penicillin and 1.44 (95% CI, 1.18-1.75) for > 5 courses. There was no change in risk for psychosis with any antibiotic group. There was a mild increase in the risk of depression and anxiety with a single course of antifungals; however, there was no increase in risk with repeated exposures. Conclusion: Recurrent antibiotic exposure is associated with increased risk for depression and anxiety but not for psychosis.