Background: TGF-β signaling pathway plays an essential role in tumor progression and immune responses. However, the link between TGF-β signaling pathway-related genes (TSRGs) and clinical prognosis, tumor microenvironment (TME), and immunotherapy in gastric cancer is unclear.Methods: Transcriptome data and related clinical data of gastric cancer were downloaded from the Cancer Genome Atlas (TCGA) and Gene Expression Omnibus (GEO) databases, and 54 TSRGs were obtained from the Molecular Signatures Database (MSigDB). We systematically analyzed the expression profile characteristics of 54 TSRGs in 804 gastric cancer samples and examined the differences in prognosis, clinicopathological features, and TME among different molecular subtypes. Subsequently, TGF-β-related prognostic models were constructed using univariate and least absolute shrinkage and selection operator (LASSO) Cox regression analysis to quantify the degree of risk in each patient. Patients were divided into two high- and low-risk groups based on the median risk score. Finally, sensitivity to immune checkpoint inhibitors (ICIs) and anti-tumor agents was assessed in patients in high- and low-risk groups.Results: We identified two distinct TGF-β subgroups. Compared to TGF-β cluster B, TGF-β cluster A exhibits an immunosuppressive microenvironment with a shorter overall survival (OS). Then, a novel TGF-β-associated prognostic model, including SRPX2, SGCE, DES, MMP7, and KRT17, was constructed, and the risk score was demonstrated as an independent prognostic factor for gastric cancer patients. Further studies showed that gastric cancer patients in the low-risk group, characterized by higher tumor mutation burden (TMB), the proportion of high microsatellite instability (MSI-H), immunophenoscore (IPS), and lower tumor immune dysfunction and exclusion (TIDE) score, had a better prognosis, and linked to higher response rate to immunotherapy. In addition, the risk score and anti-tumor drug sensitivity were strongly correlated.Conclusion: These findings highlight the importance of TSRGs, deepen the understanding of tumor immune microenvironment, and guide individualized immunotherapy for gastric cancer patients.