Peritoneal dialysis (PD) is a renal replacement therapy for end-stage renal disease. Gut microbiota-derived uremic solutes, indoxyl sulfate (IS), p-cresyl sulfate (PCS), and trimethylamine-N-oxide (TMAO) accumulate in PD patients. The objective was to explore the gut microbiota and their influence on uremic toxins in PD patients and healthy controls (HC). Fecal samples were collected from PD patients (n = 105) and HC (n = 102). 16S rRNA gene regions were sequenced for gut microbiota analysis. IS, PCS, and TMAO levels were measured using HPLC-MS. PD patients exhibited lower alpha diversity and altered gut microbiota composition compared to HC. At the genus level, PD patients showed increased abundance of opportunistic pathogenic bacteria, and decreased abundance of beneficial bacteria. Three Operational Taxonomic Units discriminated PD patients from HC. Phenylalanine metabolism increased in PD, whereas tryptophan metabolism was unaltered. Low serum PCS did not necessarily mean healthier due to the loss of alpha diversity, increased Proteobacteria and opportunistic pathogenic bacteria. High serum PCS was mainly caused by elevated p-cresol-producing bacteria, enriched amino acid related enzymes, and enhanced sulfur metabolism, rather than declined residual renal function. In patients with different urine volumes, the gut microbiota alpha diversity and composition were unaltered, but serum IS and TMAO were significantly elevated in anuric patients. In conclusion, the gut microbiota abundance, composition, and function were altered in PD patients, which increased the PCS levels. We provided a better understanding of the microbiota-metabolite-kidney axis in PD patients. Targeting certain bacteria could decrease the PCS levels, whereas preserving the residual renal function could reduce the IS and TMAO levels.