The symbiotic bacteria associated with honeybee gut have likely transformed from a free-living or parasitic lifestyle, through a close evolutionary association with the insect host. However, little is known about the genomic mechanism underlying bacterial transition to exclusive adaptation to the bee gut. Here we compared the genomes of bee gut symbionts Apibacter with their close relatives living in different lifestyles. We found that despite of general reduction in the Apibacter genome, genes involved in amino acid synthesis and monosaccharide detoxification were retained, which was likely beneficial to the host. Interestingly, the microaerobic Apibacter species have specifically preserved the NAR operon encoding for the nitrate respiration pathway which in contrast, is absent from the related non-free-living microaerobic pathogenic relatives. The NAR operon is also conserved in the cohabiting bee microbe Snodgrasella, but with a differed structure. This convergence implies a crucial role of respiration nitrate reduction for microaerophilic microbiomes to colonize bee gut epithelium. Genes involved in lipid, histidine and phenylacetate degradation are partially lost in Apibacter, possibly associated with the loss of pathogenicity. Antibiotic resistance genes were only sporadically distributed among Apibacter species, but condensed in their pathogenic relatives. Collectively, this study advanced our understanding of genomic transition underlying specialization in bee gut symbionts.