Phototherapy is the most commonly used treatment for neonatal hyperbilirubinemia (NH). Gut microbiota is involved in bilirubin metabolism; however, it is uncertain whether this is affected by phototherapy. The present study included 43 newborns with hyperbilirubinemia and collected fecal samples for high-throughput sequencing before and after phototherapy. Selection α diversity analysis was used to determine the differences in diversity and abundance between the two groups, whereas similarity was determined using β diversity analysis. Linear discriminant analysis effect size analysis was used to screen for markedly different bacteria. The structure of the gut microbiota in newborns with hyperbilirubinemia changed after phototherapy, with a significant decrease in abundance and diversity. The changes in the key bacterial species were characterized by an increase in the abundance of Streptococcus salivarius and a decrease in the abundance of Escherichia, Klebsiella pneumoniae, Rothia mucilaginosa and Streptococcus oralis. These changes mainly manifested as an increase in beneficial bacteria and a decrease in opportunistic bacteria, which may not be related to the side effects of phototherapy. These results can provide theoretical assistance for microbiological research on the later stages of NH.