AimImmune cells that infiltrate the tumor microenvironment (TME) are associated with cancer prognosis. The aim of the current study was to identify TME related gene signatures related to the prognosis of sarcoma (SARC) by using the data from The Cancer Genome Atlas (TCGA).MethodsImmune and stromal scores were calculated by estimation of stromal and immune cells in malignant tumor tissues using expression data algorithms. The least absolute shrinkage and selection operator (lasso) based cox model was then used to select hub survival genes. A risk score model and nomogram were used to predict the overall survival of patients with SARC.ResultsWe selected 255 patients with SARC for our analysis. The Kaplan–Meier method found that higher immune (p = 0.0018) or stromal scores (p = 0.0022) were associated with better prognosis of SARC. The estimated levels of CD4+ (p = 0.0012) and CD8+ T cells (p = 0.017) via the tumor immune estimation resource were higher in patients with SARC with better overall survival. We identified 393 upregulated genes and 108 downregulated genes (p < 0.05, fold change >4) intersecting between the immune and stromal scores based on differentially expressed gene (DEG) analysis. The univariate Cox analysis of each intersecting DEG and subsequent lasso-based Cox model identified 11 hub survival genes (MYOC, NNAT, MEDAG, TNFSF14, MYH11, NRXN1, P2RY13, CXCR3, IGLV3-25, IGHV1-46, and IGLV2-8). Then, a hub survival gene-based risk score gene signature was constructed; higher risk scores predicted worse SARC prognosis (p < 0.0001). A nomogram including the risk scores, immune/stromal scores and clinical factors showed a good prediction value for SARC overall survival (C-index = 0.716). Finally, connectivity mapping analysis identified that the histone deacetylase inhibitors trichostatin A and vorinostat might have the potential to reverse the harmful TME for patients with SARC.ConclusionThe current study provided new indications for the association between the TME and SARC. Lists of TME related survival genes and potential therapeutic drugs were identified for SARC.