Xiaojin Pill (XJP) is a traditional Chinese medicine prescribed for treating benign prostatic hyperplasia (BPH). It has been proven to have multiple effects, such as regulating sex hormone levels, exhibiting anti-tumor, anti-inflammatory, analgesic, and anti-platelet aggregation properties, and improving immunity. However, the material basis of XJP's therapeutic effect on BPH and its metabolic process in vivo remains to be clarified. At the same time, many microorganisms that exist in the urogenital tract, including those related to BPH, can also affect the health of the host. Using ultra-performance liquid chromatography-tandem mass spectrometry (UPLC-MS/MS), the chemical components of XJP were identified. A BPH model was created through bilateral testicular ablation and injections of testosterone propionate. A comprehensive evaluation of XJP efficacy was conducted using pathological ELISA, TUNEL, and immunohistochemical techniques. In addition, UPLC-MS metabolomics and 16S rRNA sequencing revealed the serum metabolic profile and intestinal microbiota composition. We performed a Spearman correlation coefficient analysis to highlight the interactions between "intestinal microbiota-serum factors" and "intestinal microbiota-metabolites." XJP contains 91 compounds that alleviate pathologies of BPH in rats, decreasing prostate weight, index, and serum levels of Dihydrotestosterone (DHT), Prostate-Specific Antigen (PSA), epidermal growth factor (EGF), basic fibroblast growth factor (bFGF), and vascular endothelial growth factor (VEGF) levels. It inhibits prostatic epithelial cell apoptosis and downregulates Bax, TGF-β1, and IGF-1 proteins in the caspase-3 pathway. Metabolomics studies have revealed 10 upregulated and 10 downregulated metabolites in treated rats, with 5-methylcytosine, uracil, and cytosine enriched in pyrimidine metabolism. L-arginine plays a pivotal role in metabolic pathways encompassing pyrimidine metabolism, arginine biosynthesis, and the mammalian target of rapamycin (mTOR) signaling pathway. 16S rRNA sequencing revealed that XJP optimized the diversity and balance of intestinal flora in BPH rats by decreasing the Bacteroidetes/Firmicutes (B/F) ratio, enhancing the beneficial bacteria, such as Eggerthellaceae, Anaerovoracaceae, and Romboutsia, and suppressing the dysfunctional bacteria, such as Atopobiaceae, Prevotellaceae_NK3B31_group, Dorea, and Frisingicoccus. According to the Spearman correlation coefficient analysis, Lactobacillus was found to be most associated with serum factors, whereas Romboutsia showed the highest correlation with metabolites. This finding suggests that XJP modulates pyrimidine metabolism disorders in BPH rats, a regulation that aligns closely with Romboutsia, Prevotellaceae_NK3B31_group, Lactobacillus, Chujaibacter, and Enterorhabdus, thereby providing valuable biological insights. In summary, these findings indicate that XJP possesses a synergistic anti-BHP effect through its multi-component, multi-target, multi-gut microbiota, and multi-metabolic pathway properties. The effect involves the regulation of sex hormone levels, growth factors, and the anti-epithelial cell apoptosis process. The modulation of specific gut microbiota by the host and the involvement of multiple metabolic pathways are likely one of the significant mechanisms of XJP in treating BPH. Notably, pyrimidine metabolism and the intestinal microbial ecosystem are closely intertwined in this process.