In vivo optogenetic strategies have been fundamental for the investigation of how neural circuits relate to behavior. While short-term experimental procedures are typically used in such studies, chronic stimulation during behavioral sessions has been largely unexplored. Here we describe a protocol for long-term optogenetic modulation of neuronal populations in freely moving animals.