The deficits of cognitive flexibility (including attentional set-shifting and reversal learning) concomitant with dysfunction of the striatum are observed in several neuropsychiatric disorders. Rodent and human studies have identified the striatum [particularly the dorsomedial striatum (DMS) and nucleus accumbens (NAc)] as the critical locus for control of cognitive flexibility, but the effective neuromodulator and pharmacological control of cognitive flexibility remains to be determined. The adenosine A2A receptors (A2ARs) are highly enriched in the striatopallidal neurons where they integrate dopamine and glutamate signals to modulate several cognitive behaviors, but their contribution to cognitive flexibility control is unclear. In this study, by coupling an automated operant cognitive flexibility task with striatal subregional knockdown (KD) of the A2AR via the Cre-loxP strategy, we demonstrated that NAc A2AR KD improved cognitive flexibility with enhanced attentional set-shifting and reversal learning by decreasing regressive and perseverative errors, respectively. This facilitation was not attributed to mnemonic process or motor activity as NAc A2AR KD did not affect the visual discrimination, lever-pressing acquisition, and locomotor activity, but was associated with increased attention and motivation as evident by the progressive ratio test (PRT). In contrast to NAc A2ARs, DMS A2ARs KD neither affected visual discrimination nor improved set-shifting nor reversal learning, but promoted the effort-related motivation. Thus, NAc and DMS A2ARs exert dissociable controls of cognitive flexibility with NAc A2ARs KD selectively enhancing cognitive flexibility by facilitating strategy shifting with increased motivation/attention.