Fireflies and their fascinating luminous courtships have inspired centuries of scientific study. Today firefly luciferase is widely used in biotechnology, but the evolutionary origin of their bioluminescence remains unclear. To shed light on this long-standing question, we sequenced the genomes of two firefly species that diverged over 100 million-years-ago: the North American Photinus pyralis and Japanese Aquatica lateralis. We also sequenced the genome of a related click-beetle, the Caribbean Ignelater luminosus, with bioluminescent biochemistry near-identical to fireflies, but anatomically unique light organs, suggesting the intriguing but contentious hypothesis of parallel gains of bioluminescence. Our analyses support two independent gains of bioluminescence between fireflies and click-beetles, and provide new insights into the genes, chemical defenses, and symbionts that evolved alongside their luminous lifestyle.