The recent development of neuroscience tools that combine genetics and optics, termed "optogenetics", enables control over neural circuit activity with an unprecedented level of spatial and temporal resolution. Here we provide a protocol for integrating in vivo recording with optogenetic manipulation of genetically-defined subsets of prefrontal cortical and subicular pyramidal neurons.