Brains vary greatly in neuronal number and density, even across individuals within the same species, yet it remains unclear whether such variation leads to differences in brain function or behavior. By imaging cortical activity of a mouse model in which neuronal production is moderately enhanced in utero, we find that animals with more cortical neurons also develop enhanced functional correlations and more distinct neuronal ensembles in primary visual cortex. These mice also have sharper orientation discrimination in their visual behavior. These results unveil a correlation between neuronal ensembles and behavior and suggest that neuronal number is linked to functional modularity and perceptual discrimination of visual cortex. By experimentally linking differences in neuronal number and behavior, our findings could help explain how evolutionary and developmental variability of individual and species brain size may lead to perceptual and cognitive differences.