To investigate the effect of the aryl hydrocarbon receptor (AHR)/regulatory T cell (Treg)/T-helper 17 (Th17) cell pathway on the pathogenesis of migraine. Migraine is a disabling neurovascular disease that imposes an enormous burden on both individuals and society. The pathophysiological mechanisms of migraine remain controversial. Recent studies have suggested that immune dysfunction may be involved in the pathogenesis of migraine. The AHR, a receptor expressed on most immune cells, has been implicated in the occurrence of many autoimmune diseases; however, whether it is involved in the pathogenesis of migraine is unclear. A chronic migraine rat model was established through repeated intraperitoneal injection of nitroglycerin (NTG). The mechanical and thermal pain thresholds were assessed using von Frey filaments and radiant heat. Next, the protein expression levels of AHR in the trigeminal nucleus caudalis (TNC) region of chronic migraine (CM)-like rats were quantified and the changes in Treg/Th17-related transcription factors and inflammatory factors in the TNC were explored. To determine the role of AHR in CM, we examined the effects of the AHR agonist 2-(1'-indole-3'-carbonyl)-thiazole-4-carboxylic acid methyl ester (ITE), and AHR antagonist CH-223191 on pain behavior, c-Fos, calcitonin gene-related peptide (CGRP), AHR, and Treg/Th17-related factor expression in CM-like rats. Repeated administration of NTG significantly enhanced nociceptive hypersensitivity and increased expression of c-Fos and CGRP in rats, while AHR was significantly decreased in the TNC. In addition, the expression of the transcription factor forkhead box protein P3 and the signal transducer and activator of transcription 5 decreased significantly. In contrast, the expression of the transcription factor retinoic acid receptor-related orphan receptor γ t and signal transducer and activator of transcription 3 were significantly increased. Moreover, the mRNA level of transforming growth factor beta-1 was decreased, while that of interleukin (IL)-10 and IL-22 was increased in the TNC. The AHR agonist ITE alleviated migraine-like pain behaviors in rats, activated the AHR signaling pathway, and improved the imbalance of Treg/Th17-related transcription factors and inflammatory factors. Conversely, the AHR antagonist CH-223191 did not alleviate migraine-like pain behaviors in rats; and even exacerbated them. The AHR participates in the development of CM by regulating Treg/Th17-related homeostasis. Therefore, treatments targeting the AHR/Treg/Th17 signaling pathway could be new effective interventions for CM treatment.