Optical recordings of neural activity in behaving animals can reveal the neural correlates of decision making, but such recordings are compromised by brain motion that often accompanies behavior. Two-photon point scanning microscopy is especially sensitive to motion artifacts, and to date, two-photon recording of activity has required rigid mechanical coupling between the brain and microscope. To overcome these difficulties, we developed a two-photon tracking microscope with extremely low latency (360 μs) feedback implemented in hardware. We maintained continuous focus on neurons moving with velocities of 3 mm/s and accelerations of 1 m/s2 both in-plane and axially, allowing high-bandwidth measurements with modest excitation power. We recorded from motor- and inter-neurons in unrestrained freely behaving fruit fly larvae, correlating neural activity with stimulus presentation and behavioral outputs. Our technique can be extended to stabilize recordings in a variety of moving substrates.