Citrus huanglongbing (HLB) is a devastating disease for the citrus industry. The previous studies demonstrated that oxytetracycline and penicillin are effective antibiotics against Candidatus Liberibacter asiaticus (CLas). However, since CLas is uncultured, the mechanisms of action of antibiotics against CLas are still unclear. It was recently reported that the endophytic microbial communities are associated with the progression of citrus HLB after oxytetracycline and penicillin treatment. Therefore, we hypothesize that penicillin has greater antibacterial activity against CLas than oxytetracycline, which may be associated with the alteration of the structure and function of endophytic microbial communities in HLB-affected citrus in response to these antibiotics. To test this hypothesis, the microbiome of HLB-affected citrus leaves treated with these two antibiotics was analyzed using a metagenomic method. Our results indicate that the microbial structure and function in HLB-affected citrus were altered by these two antibiotics. The relative abundance of beneficial bacterial species, including Streptomyces avermitilis and Bradyrhizobium, was higher in penicillin-treated plants compared to those treated with oxytetracycline, and the relative abundance of the bacterial species (such as Propionibacterium acnes and Synechocystis sp PCC 6803) associated with CLas survival was lower for penicillin-treated plants compared to oxytetracycline-treated plants. These results indicate that penicillin has greater antibacterial activity against CLas. Based on the metagenomic analysis, this study elucidated the mechanism for the observed increase in antibacterial activity of penicillin against CLas. The data presented here are not only invaluable for developing eco-friendly and effective biocontrol strategies to combat citrus HLB, but also provide a method for revealing mechanism of antimicrobial against uncultured bacteria in host.