Rationale: Compulsive behavior, which is a hallmark of psychiatric disorders such as addiction and obsessive-compulsive disorder, engages corticostriatal circuits. Previous studies indicate a role for corticostriatal N-methyl-d-aspartate receptors (NMDARs) in mediating compulsive-like responding for drugs of abuse, but the specific receptor subunits controlling reward-seeking in the face of punishment remain unclear. Objectives: The current study assessed the involvement of corticostriatal GluN2B-containing NMDARs in measures of persistent and punished food reward-seeking. Methods: Mice with genetic deletion of GluN2B in one of three distinct neuronal populations, cortical principal neurons, forebrain interneurons, or striatal medium spiny neurons, were tested for (1) sustained food reward-seeking when reward was absent, (2) reward-seeking under a progressive ratio schedule of reinforcement, and (3) persistent reward-seeking after a footshock punishment. Results: Mutant mice with genetic deletion of GluN2B in cortical principal neurons demonstrated attenuated suppression of reward-seeking during punishment. These mice performed normally on other behavioral measures, including an assay for pain sensitivity. Mutants with interneuronal or striatal GluN2B deletions were normal on all behavioral assays. Conclusions: Current findings offer novel evidence that loss of GluN2B-containing NMDARs expressed on principal neurons in the cortex results in reduced punished food reward-seeking. These data support the involvement of GluN2B subunit in cortical circuits regulating cognitive flexibility in a variety of settings, with implications for understanding the basis of inflexible behavior in neuropsychiatric disorders including obsessive-compulsive disorders (OCD) and addictions.