This study aimed to evaluate the effects of JK5G postbiotics to regulate imbalanced gut microbiota and its impacts on the efficacy and incidence rate of immune-related adverse events (irAEs) in non-small-cell lung cancer (NSCLC) patients treated with immune checkpoint inhibitors (ICIs). This randomized, double-blind, placebo-controlled trial was conducted in China and included non-squamous or squamous NSCLC patients without EGFR, ROS1, and ALK alteration, treatment-naive, and stage IIIb-IV. Patients were randomly (1:1) divided into two groups to receive four cycles (three weeks for each cycle) of programmed cell death-1 (PD-1) plus chemotherapy plus placebo (control group, n = 30) or to receive PD-1 plus chemotherapy plus JK5G postbiotics (JK5G group, n = 30). The primary endpoint was objective response rate. The secondary endpoints were quality of life (QoL), adverse effects, and the 16S DNA sequencing of gut microbiota, blood inflammatory cytokines, and lymphocyte subsets. This study was registered at www.chictr.org.cn (ChiCTR2200064690). Sixty patients were enrolled. The objective response rate was 36.67% (11/30) in the control group and 50.00% (15/30) in the JK5G group (p = 0.297). The JK5G group had better QoL and nutritional levels, as well as lower depression symptoms than the control group (all p < 0.05). Moreover, the JK5G group had a lower incidence of anemia (63.33% vs. 13.33%, p < 0.001), decreased lymphocyte count (20.00% vs. 0%, p = 0.010), decreased appetite (53.33% vs. 16.67%, p = 0.003), nausea (33.33% vs. 6.67%, p = 0.010), and asthenia (30.00% vs. 6.67%, p = 0.017) than the control group. Moreover, JK5G attenuated gut microbiota imbalance, accompanied by increased Faecalibacterium, Ruminococcaceae, and fecal butyrate concentration, and diminished Escherichia-Shigella. Furthermore, JK5G administration significantly decreased the levels of pro-inflammatory markers, including TNF-α, IL-2, and C-reactive protein (CRP) (all p < 0.05). Significant increases in CD3+CD4+ T cells and CD4/CD8 ratio were observed in the peripheral blood of JK5G group patients (all p < 0.05). The enterotype data showed that patients were clustered into Blautia (E1) and Escherichia-Shigella (E2) enterotypes, and JK5G postbiotics intervention might be related to enterotype modulations. Our current findings indicated that JK5G postbiotics might attenuate irAEs, and enhance the QoL and nutrition levels of advanced NSCLC patients who received ICIs. JK5G postbiotics could also improve the gut microbiota structures and ameliorate the tumor microenvironment andinflammation. www.chictr.org.cn, identifier ChiCTR2200064690.