The efficacy of neoadjuvant chemotherapy (NACT) in patients with advanced gastric cancer (GC) varies greatly. Thus, we aimed to verify the predictive value of tumor-infiltrating immune cells (TIICs) on the treatment response to NACT and the prognosis of patients with advanced GC, and to explore the impact of NACT on the tumor immune microenvironment (TIME). Paired tumor tissues (pre- and post-NACT) from patients with advanced GC were collected for this study. TIICs were assessed using immunohistochemistry staining and analyzed using logistic regression to establish an immune microenvironment score for GC (ISGC score) and predict NACT efficacy. Kaplan-Meier curves were used to evaluate the survival outcome of patients. The results showed that TIME was dramatically heterogeneous between NACT response and nonresponse patients. In the validation cohort, the ISGC score demonstrated good predictive performance for treatment response to NACT. Moreover, high ISGC indicated better long-term survival in patients with advanced GC. Furthermore, tumor-infiltrated T cells (CD3+ and CD8+) and CD11c+ macrophages were significantly increased in the response group, while CD163+ macrophages and FOXP3+ Treg cells were decreased after NACT. However, opposite results were exhibited in the nonresponse group. Finally, we found that the percentage of programmed cell death ligand 1 (PD-L1)-positive tumors was 31% (32/104) pre-NACT and 49% (51/104) post-NACT, and almost all patients with elevated PD-L1 were in the NACT response group. The ISGC model accurately predicted NACT efficacy and classified patients with GC into different survival groups. NACT regulates the TIME in GC, which may provide strategies for personalized immunotherapy.