Many bacteria live in close association with other organisms such as plants and animals, with important implications for both health and disease. This thesis investigates bacteria that are well adapted to live inside an animal host, and describes the molecular evolutionary processes underlying host-adaptation, based on bacterial genome comparisons. Insect-transmitted bacteria of the genus Bartonella infect the red blood cells of mammals, and we investigate host adaptation and genome evolution in this genus. In Bartonella, many host-interaction systems are encoded in a highly variable chromosomal segment previously shown to be amplified and packaged into bacteriophage particles. Among all genes imported into the Bartonella ancestor, we identify the short gene cluster encoding these phage particles as the most evolutionary conserved, indicating a strong selective advantage and a role in niche adaptation. We also provide an overview of the remarkable evolutionary dynamics of type IV and type V secretion systems, including a detailed analysis of the type IV secretion system trw. Our results highlight the importance of recombination and gene conversion in the evolution of host-adaptation systems, and reveal how these mutational mechanisms result in strikingly different outcomes depending on the selective constraints. In the insect endosymbionts Buchnera and Blochmannia, we show that genes frameshifted at poly(A) tracts can remain functional due to transcriptional slippage. Selection against poly(A) tracts is very inefficient in these genomes compared to other bacteria, and we discuss why this can lead to increased rates of gene loss. Using the human pathogen Helicobacter pylori as a model, we provide a deeper understanding of why highly expressed genes evolve slowly. This thesis emphasizes the power of using complete genome sequences to study evolutionary processes. In particular, we argue that knowledge about the complex evolution of duplicated gene segments is crucial to understand host adaptation in bacteria