Disruptions in gut microbiome are implicated in cardiometabolic disorders and other health outcomes. Antibiotics are known gut microbiome disruptors, but their long-term consequences remain underexplored. Here we combined individual-level data from the Swedish Prescribed Drug Register with fecal metagenomes of 14,979 adults to examine the association between oral antibiotic use over 8 years and gut microbiome. In multivariable confounder-adjusted regression models, antibiotic use <1 year before fecal sampling was associated with the greatest reduction in species diversity, but significant associations were also observed for use 1-4 and 4-8 years earlier. Clindamycin, fluoroquinolones and flucloxacillin accounted for most of the associations with the abundance of individual species. Use of these antibiotics 4-8 years earlier was associated with altered abundance of 10-15% of the species studied; penicillin V, extended-spectrum penicillins and nitrofurantoin were associated with only a few species. Similar results were found comparing one antibiotic course 4-8 years before sampling versus none in the past 8 years. These findings indicate that antibiotics may have long-lasting consequences for the gut microbiome.