The Xuanfei Baidu Decoction (XFBD) has shown effective therapeutic potential for acute lung injury (ALI) induced by lipopolysaccharide and immunoglobin G immune complexes. Herein, the protective effects and mechanisms of XFBD were investigated in a sepsis-induced ALI mouse model along with its effects on gut microbiota. Notably, bioinformatics and molecular docking analyses revealed that XFBD components exhibited a strong binding affinity to G-protein-coupled receptor 18 (GPR18). In the murine ALI model-induced by cecal ligation and puncture (CLP)-XFBD markedly improved lung histopathology, reduced M1 macrophage polarization, and decreased pro-inflammatory cytokine levels in both lung tissues and MH-S macrophages. Furthermore, XFBD downregulated key inflammatory pathways, including nuclear factor (NF)-κB, phosphorylated-NF-κB, CCAAT/enhancer binding protein-δ, and the nucleotide-binding oligomerization domain-like receptor pyrin domain-containing 3/Caspase-1/gasdermin D axis. Additionally, XFBD restored the CLP-induced disruption in gut microbiota balance, increasing the abundance of Prevotellaceae and Ruminococcaceae_UCG_014. Altogether, the findings of this study suggest that XFBD alleviates CLP-induced ALI by modulating gut microbial homeostasis and inhibiting associated inflammatory pathways, particularly via GPR18 activation, presenting the promising therapeutic potential of XFBD for treating sepsis-induced ALI.