Sorafenib is used to treat digestive system tumors in patients who do not respond to or cannot tolerate surgery. However, the roles and inhibitory mechanisms of sorafenib against hepatocellular carcinoma (HCC) are unclear. Differentially expressed genes in tissues from responders and nonresponders to sorafenib were investigated using the HCC GSE109211 data set. Biological functions and mechanisms were studied using the Gene Ontology and Kyoto Encyclopedia of Genes and Genomes databases. The expression levels of differential expressed target genes were identified in HCC tissues, using The Cancer Genome Atlas database, and their prognostic and diagnostic values were explored using survival and receiver operating characteristic curve analysis. A nomogram and risk model of sorafenib-response target genes enabled the evaluation of the prognosis of patients with HCC. The relationship between risk scores and levels of infiltrating immune cells was visualized via correlation analysis. We identified 1620 sorafenib-response target genes involved in the PPAR signaling pathway, antigen processing and presentation, and ferroptosis. SLC41A3, SEC61A1, LRP4, PPM1G, and HSP90AA1 were independent risk factors for a poor prognosis for patients with HCC and had diagnostic value. A risk model based on SLC41A3, SEC61A1, LRP4, PPM1G, and HSP90AA1 expression showed that patients with HCC in the high-risk group had a worse prognosis. Consensus-clustering analysis (performed with K set to 2) distinguished two clusters (the cluster 1 and cluster 2 groups). Patients in cluster 1 survived significantly longer than those in cluster 2. The risk score correlated with the levels of T cells, cytotoxic lymphocytes, CD8+ T cells, macrophages, memory B cells, follicular helper T cells, and other immune cells. The high risk based on the sorafenib-response targets SLC41A3, SEC61A1, LRP4, PPM1G, and HSP90AA1 represented the poor prognosis for patients with HCC and significantly correlated with the levels of immune infiltrating cells in HCC.