Coordinated activity patterns in the developing brain may contribute to the wiring of neuronal circuits underlying future behavioural requirements. However, causal evidence for this hypothesis has been difficult to obtain owing to the absence of tools for selective manipulation of oscillations during early development. We established a protocol that combines optogenetics with electrophysiological recordings from neonatal mice in vivo to elucidate the substrate of early network oscillations in the prefrontal cortex. We show that light-induced activation of layer II/III pyramidal neurons that are transfected by in utero electroporation with a high-efficiency channelrhodopsin drives frequency-specific spiking and boosts network oscillations within beta-gamma frequency range. By contrast, activation of layer V/VI pyramidal neurons causes nonspecific network activation. Thus, entrainment of neonatal prefrontal networks in fast rhythms relies on the activation of layer II/III pyramidal neurons. This approach used here may be useful for further interrogation of developing circuits, and their behavioural readout.