Although individual neurons can be highly selective to particular stimuli and certain upcoming actions, they can provide a complex representation of stimuli and actions at the level of population. The ability to dynamically allocate neural resources is crucial for cognitive flexibility. However, it is unclear whether cognitive flexibility emerges from changes in activity at the level of individual neurons, population, or both. By applying a combination of decoding and encoding methods to simultaneously recorded neural data, we show that while maintaining their stimulus selectivity, neurons in prefrontal cortex alter their correlated activity during various cognitive states, resulting in an enhanced representation of visual space. During a task with various cognitive states, individual prefrontal neurons maintained their limited spatial sensitivity between visual encoding and saccadic target selection whereas the population selectively improved its encoding of spatial locations far from the neurons' preferred locations. This 'encoding expansion' relied on high-dimensional neural representations and was accompanied by selective reductions in noise correlation for non-preferred locations. Our results demonstrate that through recruitment of less-informative neurons and reductions of noise correlation in their activity, the representation of space by neuronal ensembles can be dynamically enhanced, and suggest that cognitive flexibility is mainly achieved by changes in neural representation at the level of population of prefrontal neurons rather than individual neurons.