Immune checkpoint inhibitors (ICIs) improve overall survival in patients with advanced gastric cancer (GC). However, the molecular characterization of GC in ICIs responders is unclear. A total of 288 advanced GC patients were included in this study. Next-generation sequencing analysis was performed on tumor tissue and paired blood to screen for somatic mutants in 639 tumor-associated genes. We demonstrated that ARID1A, HER2/3/4, KMT2C/2D, LRP1B, PIK3CA, SPTA1, and TP53 mutations were significantly correlated with high tumor mutation burden (TMB) score, as well as HER2 amplification. For HER2 and PIK3CA mutations types, this relationship was statistically significant with age and TP53 mutation status, which was also found in the CDH1 gene. These results were confirmed by sequencing 873 GC cases in the cBioPortal database. PIK3CA mutations appear to be associated with longer survival in elderly population and TP53 mutant subtypes. For the first time, we found that GC patients ≥60 years old or with TP53 mutated type and PIK3CA mutations were associated with higher TMB and better ICI response. Building upon the age and TP53 mutation status, this study suggested a novel stratification approach to GC patients and explored the correlations between genetic somatic mutations and TMB score.