HtrA serine peptidase 4 (HTRA4), which belongs to the AB family of proteases/chapterones, participates in multiple signal pathways and plays an important regulatory role in some malignancies; however, its role in the prognosis and immune infiltrates of gastric cancer (GC) remains unclear. HTRA4 expression was thus investigated in tumor tissues, and its association with immune infiltrates was assessed, to determine its prognostic roles in GC patients. Data for patients with GC was collected from three GEO datasets. This study has investigated if high expression levels of HTRA4 are associated with a poor prognosis in GC patients, especially in T2,T3,N1,NI&N2&N3,M1,stage3 and HER2+ subgroups. HTRA4 was positively correlated with CD8+ T cells, CD4+ memory activated T cells, gamma delta T cells, and M2 macrophages in the GC microenvironment. Gene Ontology and Gene set Enrichment Analysis showed that HTRA4 was enriched in some immune-related pathways. High expression levels of HTRA4 were significantly correlated with tumors in the T stage, N stage, and clinical stage, as well as those of histological grade. In summary, HTRA4 was found to play a vital role in the progression of GC and may be a predictive biomarker for the survival of GC patients.