Hepatocellular carcinoma (HCC) is the most common primary malignant liver tumor with limited treatment. The ketogenic diet (KD) emerged as a metabolic therapy for cancer; however, the antitumor effect on HCC remains controversial. We previously reported that the ketogenesis rate-limiting enzyme, 3-hydroxymethylglutaryl-CoA synthase 2 (HMGCS2), was downregulated in most patients with HCC. The knockdown of HMGCS2 enhanced the proliferation and metastasis ability of HCC cells. However, the role of HMGCS2 in affecting KD-mediated metabolic effects remains unclear. Here, we report that KD feeding upregulates HMGCS2 expression and inhibits HCC tumor growth, while a reverse correlation between tumor size and HMGCS2 expression was observed. We found that HCC cells with HMGCS2 downregulation possess altered lipid metabolism that increases fatty acid, triglyceride, and cholesterol synthesis. Under KD feeding, a higher tumor growth rate was observed in HMGCS2 knockdown tumors, which had increased lipid synthesis-related marker expression and a positive correlation between lipid quantity and tumor weight. In conclusion, these results demonstrate that the downregulation of HMGCS2 attenuates the protective effect of the KD by shifting ketone production to enhance de novo lipogenesis in HCC. Our study elucidates a new molecular mechanism underlying the crosstalk between HMGCS2 expression and the KD in cancer treatment, which provides more information for precision medicine in developing personalized treatment strategies.