Advanced gastric cancer (AGC) has high morbidity and mortality in East Asia, and it is urgent to explore new treatments to improve patient prognosis. Programmed death-1 (PD-1)/programmed death-ligand 1 (PD-L1) inhibitors have exhibited remarkable activity in clinical trials and were approved by the FDA for clinical therapy in several types of tumors. Here, we evaluated PD-L1 expression and T cell infiltration in AGC. Positive tumor PD-L1 expression was detected in 171 AGCs (33.60%) out of 509 AGCs. PD-L1 expression was positively correlated with CD8+ T cell infiltration. Then, PD-L1 and CD8A mRNA expression was analyzed using gastric cancer data from the TCGA database, confirming a positive correlation. Patient survival was assessed according to PD-L1 status and the T cell infiltration density. PD-L1 expression and a high density of CD8+ T cells in AGCs were associated with improved prognosis, whereas no significant difference was noted between PD-1 and CD3 expression. In contrast, a high density of FOXP3+ T cells in AGCs indicated a poor prognosis. Multivariate Cox regression analysis revealed that CD8+ T cell density acts as an independent predictor of overall survival (OS) in AGC patients. Taken together, this study further highlights targets for immune checkpoint-based therapy in AGC.