Polymorphisms in the gene encoding the serotonin synthesis enzyme Tph2 have been identified in mental illnesses, including bipolar disorder, major depression, autism, schizophrenia, and ADHD. Deficits in cognitive flexibility and perseverative behaviors are shared common symptoms in these disorders. However, little is known about the impact of Tph2 gene variants on cognition. Mice expressing a human TPH2 variant (Tph2-KI) were used to investigate cognitive consequences of TPH2 loss of function and pharmacological treatments. We applied a recently developed behavioral assay, the automated H-maze, to study cognitive functions in Tph2-KI mice. This assay involves the consecutive discovery of three different rules: a delayed alternation task, a non-alternation task, and a delayed reversal task. Possible contribution of locomotion, reward, and sensory perception were also investigated. The expression of loss-of-function mutant Tph2 in mice was associated with impairments in reversal learning and cognitive flexibility, accompanied by perseverative behaviors similar to those observed in human clinical studies. Pharmacological restoration of 5-HT synthesis with 5-hydroxytryptophan or treatment with the 5-HT(2C) receptor agonist CP809.101 reduced cognitive deficits in Tph2-KI mice and abolished perseveration. In contrast, treatment with the psychostimulant methylphenidate exacerbated cognitive deficits in mutant mice. Results from this study suggest a contribution of TPH2 in the regulation of cognition. Furthermore, identification of a role for a 5-HT(2) receptor agonist as a cognition-enhancing agent in mutant mice suggests a potential avenue to explore for the personalized treatment of cognitive symptoms in humans with reduced 5-HT synthesis and TPH2 polymorphisms.