Specialized metabolites are molecules involved in plants interaction with their environment. Elucidating their biosynthetic pathways is a challenging but rewarding task, leading to societal applications and ecological insights. Furanocoumarins emerged multiple times in Angiosperms, raising the question of how different enzymes evolved into catalyzing identical reactions.To identify enzymes producing lineage-specific metabolites, an evolutionary-based approach was developed and applied to furanocoumarin biosynthesis in Ficus carica (Moraceae). This led to the characterization of CYP71B129-131a, three P450 enzymes whose evolution of the function was investigated using phylogenetics, structural comparisons and site-directed mutagenesis. CYP71B129 and CYP71B130,131a were found to hydroxylate umbelliferone (coumarin) and xanthotoxin (furanocoumarin), respectively. Results suggest that CYP71Bs xanthotoxin hydroxylase activity results from duplications and functional divergence of umbelliferone hydroxylase genes. Structural comparisons highlighted an amino acid affecting CYP71Bs substrate specificity, which may play a key role in allowing xanthotoxin hydroxylation in several P450 subfamilies. CYP71B130-131a characterization validates the proposed enzyme-discovery approach, which can be applied to different pathways and help to avoid the classic bottlenecks of specialized metabolism elucidation. The CYP71Bs also exemplify how furanocoumarin-biosynthetic enzymes can stem from coumarin-biosynthetic ones and provides insights into the molecular mechanisms underlying the multiple emergences of xanthotoxin hydroxylation in distant P450 subfamilies.