Summary: Some insects have evolved beneficial relationships with intestinal microbes for sex pheromone production to communicate with conspecifics effectively. However, it is not clear whether the sex pheromone synthesis activity of intestinal microbes can be controlled by the host, and the molecular mechanisms need to be further unraveled. In this study, we find that rectal gland Bacillus species of male Bactrocera dorsalis specifically produce sex pheromones in the evening, which is significantly associated with glucose levels. In vitro Bacillus culture assays show that glucose levels significantly influence the amount of sex pheromone produced. Comparative rectal gland transcriptome analysis reveals that the expressions of the alpha-galactosidase gene (GLA), a Bactrocera dorsalis transcription factor (BDTF), and a pigment-dispersing factor (PDF) are responsible for producing glucose. Our findings reveal that the PDF-BDTF-GLA module influences the intestinal-microbe-produced sex pheromone by regulating glucose levels and advance our understanding of interactions between insects and their intestinal microbes.