Background The sustained effectiveness of anti-programmed cell death protein-1 (PD1) treatment is limited to a subgroup of patients with hepatocellular carcinoma (HCC) due to the tumor microenvironment heterogeneity, highlighting the need to identify targetable biomarkers that synergize with PD1 blockade. Abnormal cholesterol metabolism plays a critical role in HCC progression, along with growing evidence indicating its complex immunomodulatory effects within the tumor microenvironment. However, the interplay between cholesterol homeostasis and immune evasion remains elusive. Methods Transcriptomic and clinical data from HCC datasets were analyzed to identify cholesterol metabolism-related targets. Multiplex immunostaining and flow cytometry were applied to examine the immune landscape association with squalene epoxidase (SQLE) in human and murine tumors. Mechanistic studies were conducted in vitro, and co-culture experiments of tumor cells and T cells were followed by metabolomics and transcriptome analyses. Therapeutic efficacy was evaluated in mouse HCC models. Results We demonstrated that elevated SQLE expression in human HCC was associated with poor clinical outcomes and correlated with reduced CD8 + T cell infiltration and activation. Pharmacological inhibition or genetic knockdown of SQLE in tumor cells promoted CD8 + T cell proliferation and activation in co-culture experiments. Untargeted metabolomics identified 27-hydrocholesterol, an oxysterol derived from tumor cells, as a key factor impairing CD8 + T cell function via cholesterol dysregulation. SQLE inhibition in tumor cells suppressed oxysterols secretion, therefore overcoming cholesterol restrictions and enhancing the immune responses of CD8 + T cells. Moreover, SQLE targeting with terbinafine restored antitumor immunity and synergized with anti-PD1 therapy in HCC. Conclusion Targeting tumorous SQLE restores CD8 + T cell function by overcoming cholesterol restrictions via oxysterol-SREBP2 signaling, highlighting SQLE as a potential therapeutic target to enhance immunotherapy efficacy in HCC.