The imbalance of gut microbiota (GM) is associated with a higher risk of thrombosis in patients with atrial fibrillation (AF). Oral anticoagulants (OACs) have been found to significantly reduce the risk of thromboembolism and increase the risk of bleeding. However, the OAC-induced alterations in gut microbiota in patients with AF remain elusive. In this study, the microbial composition in 42 AF patients who received long-term OAC treatment (AF-OAC group), 47 AF patients who did not (AF group), and 40 volunteers with the risk of AF (control group) were analyzed by 16S rRNA gene sequencing of fecal bacterial DNA. The metagenomic functional prediction of major bacterial taxa was performed using the Phylogenetic Investigation of Communities by Reconstruction of Unobserved States (PICRUSt) software package. The gut microbiota differed between the AF-OAC and AF groups. The abundance of Bifidobacterium and Lactobacillus decreased in the two disease groups at the genus level, but OACs treatment mitigated the decreasing tendency and increased beneficial bacterial genera, such as Megamonas. In addition, OACs reduced the abundance of pro-inflammatory taxa on the genus Ruminococcus but increased certain potential pathogenic taxa, such as genera Streptococcus, Escherichia-Shigella, and Klebsiella. The Subgroup Linear discriminant analysis effect size (LEfSe) analyses revealed that Bacteroidetes, Brucella, and Ochrobactrum were more abundant in the anticoagulated bleeding AF patients, Akkermansia and Faecalibacterium were more abundant in the non-anticoagulated-bleeding-AF patients. The neutrophil-to-lymphocyte ratio (NLR) was lower in the AF-OAC group compared with the AF group (P < 0.05). Ruminococcus was positively correlated with the NLR and negatively correlated with the CHA2DS2-VASc score (P < 0.05), and the OACs-enriched species (Megamonas and Actinobacteria) was positively correlated with the prothrombin time (PT) (P < 0.05). Ruminococcus and Roseburia were negatively associated with bleeding events (P < 0.05). Our study suggested that OACs might benefit AF patients by reducing the inflammatory response and modulating the composition and abundance of gut microbiota. In particular, OACs increased the abundance of some gut microbiota involved in bleeding and gastrointestinal dysfunction indicating that the exogenous supplementation with Faecalibacterium and Akkermansia might be a prophylactic strategy for AF-OAC patients to lower the risk of bleeding after anticoagulation.