This retrospective study revealed that B cells in the TME, assessed through gene expression profiles and IHC, were associated with CB and favorable prognosis in patients with advanced ESCC treated with anti-PD-1-based or anti-PD-L1-based immunotherapy. This evidence concerns the gene CD274 and esophageal squamous cell carcinoma.