Liver cancer is the second leading cause of cancer mortality worldwide, causing more than 700,000 deaths annually. Because of the wide landscape of genomic alterations and limited therapeutic success of targeting tumor cells, a recent focus has been on better understanding and possibly targeting the microenvironment in which liver tumors develop. A unique feature of liver cancer is its close association with liver fibrosis. More than 80% of hepatocellular carcinomas (HCCs) develop in fibrotic or cirrhotic livers, suggesting an important role of liver fibrosis in the premalignant environment (PME) of the liver. Cholangiocarcinoma (CCA), in contrast, is characterized by a strong desmoplasia that typically occurs in response to the tumor, suggesting a key role of cancer-associated fibroblasts (CAFs) and fibrosis in its tumor microenvironment (TME). Here, we discuss the functional contributions of myofibroblasts, CAFs, and fibrosis to the development of HCC and CCA in the hepatic PME and TME, focusing on myofibroblast- and extracellular matrix—associated growth factors, fibrosis-associated immunosuppressive pathways, as well as mechanosensitive signaling cascades that are activated by increased tissue stiffness. Better understanding of the role of myofibroblasts in HCC and CCA development and progression may provide the basis to target these cells for tumor prevention or therapy.