In summary, our study shows that B cells in the TME were associated with efficacy and improved outcomes in patients with ESCC undergoing anti-PD-1/PD-L1-based immunotherapy. This evidence concerns the gene CD274 and esophageal squamous cell carcinoma.