Reversal learning has been shown to require intact serotonergic innervation of the forebrain neocortex. Whether dopamine acting through D2 receptors plays a complementary role in this anatomic area is still unclear. Here we show that mice lacking dopamine D2 receptors exhibited significantly impaired performance in the reversal learning phase of an attention-set-shifting task (ASST) and that wild type mice treated chronically with the D2-like receptor antagonist haloperidol exhibited the same cognitive deficit. The test-phase-specific deficits of D2 mutants and haloperidol-treated mice were also accompanied by deficits in the induction of expression of early growth response gene 2 (egr-2), a regulatory transcription factor previously shown to be selectively induced in the ventrolateral orbital frontal cortex and the pre- and infralimbic medial prefrontal cortex of ASST-tested mice. D2-receptor knockout mice and haloperidol-treated wild type, however, exhibited lower egr-2 expression in these anatomic regions after completion of an ASST-test phase that required reversal learning but not after completion of set-shifting phases without rule reversals. In contrast, mice treated chronically with clozapine, an atypical neuroleptic drug with lower D2-receptor affinity and broader pharmacological effects, had deficits in compound discrimination phases of the ASST, but also these deficits were accompanied by lower egr-2 expression in the same anatomic subregions. Thus, the findings indicate that egr-2 expression is a sensitive indicator of test-phase-specific performance in the ASST and that normal function of D2 receptors in subregions of the orbital frontal and the medial prefrontal cortex is required for cognitive flexibility in tests involving rule reversals.