The order Chiroptera, bats, exhibits extremely high genetic and dietary diversity, and includes the only three obligate sanguivorous mammals, the vampire bats. Relying on blood as the sole dietary source poses significant challenges, ranging from morphological to nutritional. To study the evolution of sanguivory we used a hologenomic approach, in which we identified adaptive changes in the vampire genome as well as in its gut microbiome. To this end, we generated a high-quality reference genome (N50=26.9 Mb) for the common vampire bat, Desmodus rotundus, using a combination of de novo assembly and a Hi-C-based contiguity refinement technology. We then performed comparative genomic analyses against bats with other diets (frugivorous, insectivorous, and carnivorous), including gene selection, gene loss, and gene family expansion-contraction. We also generated metagenomics datasets by shotgun sequencing faecal samples of D. rotundus and bats with other diets. We identified taxa and functions that were differentially abundant or present only in the vampire bat. Our combined genomics and metagenomics results highlight how both genome and gut microbiome played key roles in the evolution of sanguivory, through affecting traits such as energy metabolism, immunity, digestive system morphogenesis, and osmotic homeostasis. The common vampire bat represents a perfect example of the study of the evolution of complex phenotypes in non-model organisms by analysing its genome and gut microbiome in a complementary fashion. Overall, our results highlight that studies not accounting for the action of both the genome and the microbiome provide incomplete insights into the evolution of complex adaptations.