Chronic inflammation promotes oncogenic transformation and tumor progression. Many inflammatory agents also generate a toxic microenvironment, implying that adaptive mechanisms must be deployed for cells to survive and undergo transformation in such unfavorable contexts. A paradigmatic case is represented by cancers occurring in pediatric patients with genetic defects of hepatocyte phosphatidylcholine transporters and in the corresponding mouse model (Mdr2-/- mice), in which impaired bile salt emulsification leads to chronic hepatocyte damage and inflammation, eventually resulting in oncogenic transformation. By combining genomics and metabolomics, we found that the transition from inflammation to cancer in Mdr2-/- mice was linked to the sustained transcriptional activation of metabolic detoxification systems and transporters by the Constitutive Androstane Receptor (CAR), a hepatocyte-specific nuclear receptor. Activation of CAR-dependent gene expression programs coincided with reduced content of toxic bile acids in cancer nodules relative to inflamed livers. Treatment of Mdr2-/- mice with a CAR inhibitor blocked cancer progression and caused a partial regression of existing tumors. These results indicate that the acquisition of resistance to endo- or xeno-biotic toxicity is critical for cancers that develop in toxic microenvironments.