Opioids, such as morphine, are used in the Neonatal Intensive Care Unit (NICU) for pain relief in neonates. However, the available evidence concerning the benefits and harms of opioid therapy in neonates remains limited. While previous studies have reported that neonatal morphine exposure (NME) results in long-term heightened pain sensitivity, the underlying mechanisms are not well understood. This study proposes that dysbiosis of the gut microbiome contributes to pain hypersensitivity following NME. Using an adolescent female murine model, pain sensitivity was evaluated using tail flick and hot plate assays for thermal pain and the Von Frey assay for mechanical pain. Gut microbiome composition was assessed using 16 s rRNA sequencing, while transcriptomic changes in midbrain samples were investigated using bulk RNA-sequencing. NME induced prolonged hypersensitivity to thermal and mechanical pain in adolescence, accompanied by persistent gut microbial dysbiosis and sustained systemic inflammation, characterized by elevated circulating cytokine levels (e.g., IL-1α, IL-12p70, IFN-γ, IL-10). Transplantation of the microbiome from NME adolescents recapitulated pain hypersensitivity in naïve adolescent mice, while neonatal probiotic intervention with Bifidobacterium infantis (B. infantis) reversed the hypersensitivity by preventing gut dysbiosis and associated systemic inflammation. Furthermore, transcriptomic analysis of the midbrain tissues revealed that NME upregulated several genes and key signaling pathways, including those related to immune activation and excitatory signaling, which were notably mitigated by neonatal B. infantis administration. Together, these findings highlight the critical role of the gut-brain axis in modulating pain sensitivity and suggest that targeting the gut microbiome offers a promising therapeutic strategy for managing neurobiological disorders following early opioid exposure.