Microbial amino acid composition (AA) reflects adaptive strategies of cellular and molecular regulations such as a high proportion of acidic AAs, including glutamic and aspartic acids in alkaliphiles. It remains understudied how microbial AA content is linked to their pH adaptation especially in natural environments. Here we examined prokaryotic communities and their AA composition of genes with metagenomics for 39 water and sediments of East African lakes along a gradient of pH spanning from 7.2 to 10.1. We found that Shannon diversity declined with the increasing pH and that species abundance were either positively or negatively associated with pH, indicating their distinct habitat preference in lakes. Microbial communities showed higher acidic proteomes in alkaline than neutral lakes. Species acidic proteomes were also positively correlated with their pH preference, which was consistent across major bacterial lineages. These results suggest selective pressure associated with high pH likely shape microbial amino acid composition both at the species and community levels. Comparative genome analyses further revealed that alkaliphilic microbes contained more functional genes with higher acidic AAs when compared to those in neutral conditions. These traits included genes encoding diverse classes of cation transmembrane transporters, antiporters, and compatible solute transporters, which are involved in cytoplasmic pH homeostasis and osmotic stress defense under high pH conditions. Our results provide the field evidence for the strong relationship between prokaryotic AA composition and their habitat preference and highlight amino acid optimization as strategies for environmental adaptation.