Bats account for ~20% of all extant mammal species and are considered exceptional given their extraordinary adaptations, including biosonar, true flight, extreme longevity, and unparalleled immune systems. To understand these adaptations, we generated reference-quality genomes of six species representing the key divergent lineages. We assembled these genomes with a novel pipeline incorporating state-of-the-art long-read and long-range sequencing and assembly techniques. The genomes were annotated using a maximal evidence approach, de novo predictions, protein/mRNA alignments, Iso-seq long read and RNA-seq short read transcripts, and gene projections from our new TOGA pipeline, retrieving virtually all (>99%) mammalian BUSCO genes. Phylogenetic analyses of 12,931 protein coding-genes and 10,857 conserved non-coding elements identified across 48 mammalian genomes helped to resolve bats' closest extant relatives within Laurasiatheria, supporting a basal position for bats within Scrotifera. Genome-wide screens along the bat ancestral branch revealed (a) selection on hearing-involved genes (e.g LRP2, SERPINB6, TJP2), which suggest that laryngeal echolocation is a shared ancestral trait of bats; (b) selection (e.g INAVA, CXCL13, NPSR1) and loss of immunity related proteins (e.g. LRRC70, IL36G), including pro-inflammatory NF-kB signalling; and (c) expansion of the APOBEC family, associated with restricting viral infection, transposon activity and interferon signalling. We also identified unique integrated viruses, indicating that bats have a history of tolerating viral pathogens, lethal to other mammal species. Non-coding RNA analyses identified variant and novel microRNAs, revealing regulatory relationships that may contribute to phenotypic diversity in bats. Together, our reference-quality genomes, high-quality annotations, genome-wide screens and in-vitro tests revealed previously unknown genomic adaptations in bats that may explain their extraordinary traits.