Solanum nigrum, known as black nightshade, is a medicinal plant that contains many beneficial metabolites in its fruit. The molecular mechanisms underlying the synthesis of these metabolites remain uninvestigated due to limited genetic information. Here, we identified 47,470 unigenes of S. nigrum from three different tissues by de novo transcriptome assembly, and 78.4% of these genes were functionally annotated. Moreover, gene ontology (GO) analysis using 18,860 differentially expressed genes (DEGs) revealed tissue-specific gene expression regulation. We compared gene expression patterns between S. nigrum and tomato (S. lycopersicum) in three tissue types. The expression patterns of carotenoid biosynthetic genes were different between the two species. Comparison of the expression patterns of flavonoid biosynthetic genes showed that 9 out of 14 enzyme-coding genes were highly upregulated in the fruit of S. nigrum. Using CRISPR-Cas9-mediated gene editing, we knocked out the R2R3-MYB transcription factor SnAN2 gene, an ortholog of S. lycopersicum ANTHOCYANIN 2. The mutants showed yellow/green fruits, suggesting that SnAN2 plays a major role in anthocyanin synthesis in S. nigrum. This study revealed the connection between gene expression regulation and corresponding phenotypic differences through comparative analysis between two closely related species and provided genetic resources for S. nigrum.