BackgroundThe management of advanced clear cell renal cell carcinoma (ccRCC) remains a major challenge in clinical practice, and the construction of more reliable prognostic prediction models and the further elucidation of key molecular mechanisms of tumor progression are topics in urgent need of in-depth investigation.MethodsWe used CIBERSORT to estimate the proportion of 22 tumor-infiltrating immune cell types in the TCGA-KIRC cohort. Weighted gene co-expression network analysis, least absolute shrinkage and selection operator regression analysis were used to build risk prediction models. Expression patterns and clinical significance of TRAF2 were determined through bioinformatics analysis, real-time qPCR, Western Blot, immunohistochemistry. GSEA analysis, transmission electron microscopy, 2D/3D colony formation assay, cell migration and invasion assay, and tube-formation assay were used to investigate the underlying function and mechanism of the TRAF2/M2 macrophage/autophagy axis.ResultsWe constructed a novel prognostic prediction model based on M2 macrophage-related genes, which was identified as an accurate, independent and specific prognostic risk model for ccRCC patients. A reliable nomogram was constructed to predict 1-, 3-, and 5-year overall survival for patients with ccRCC. As one of the constituent genes of the risk model, TRAF2 was determined to be upregulated in ccRCC and associated with poor clinical prognosis. We found that TRAF2 promotes malignant progression of ccRCC by regulating macrophage polarization, migration and angiogenesis. Mechanistically, we found that TRAF2 promotes the polarization of M2 macrophages, and this chemotaxis is achieved in an autophagy-dependent pathway. Orthotopic tumor growth assay results revealed that TRAF2 plays a key role as a promotor of ccRCC growth and metastasis.ConclusionsIn conclusion, this risk model is highly predictive of prognostic in ccRCC patients, which is expected to promote improved treatment evaluation and comprehensive management of ccRCC. Moreover, our findings reveal that the TRAF2/M2 macrophage/autophagy axis plays a key regulatory role in the malignant progression of ccRCC, and suggest that TRAF2 is a potential novel therapeutic target for advanced ccRCC.Supplementary InformationThe online version contains supplementary material available at 10.1186/s13046-023-02742-w.