CRISPR/Cas9 has revolutionized cancer mouse models. Although loss-of-function genetics by CRISPR/Cas9 is well-established, generating gain-of-function alleles in somatic cancer models is still challenging because of the low efficiency of gene knock-in. Here we developed CRISPR-based Somatic Oncogene kNock-In for Cancer Modeling (CRISPR-SONIC), a method for rapid in vivo cancer modeling using homology-independent repair to integrate oncogenes at a targeted genomic locus. Using a dual guide RNA strategy, we integrated a plasmid donor in the 3′-UTR of mouse β-actin, allowing co-expression of reporter genes or oncogenes from the β-actin promoter. We showed that knock-in of oncogenic Ras and loss of p53 efficiently induced intrahepatic cholangiocarcinoma in mice. Further, our strategy can generate bioluminescent liver cancer to facilitate tumor imaging. This method simplifies in vivo gain-of-function genetics by facilitating targeted integration of oncogenes.