Two-photon imaging of fluorescence in brain enables analysis of the structure and dynamic activity of neurons and glial cells in living animals. However, vital functions such as beating of the heart cause pulsations in brain tissue, leading to image distortion and loss of resolution. We find that synchronizing imaging scans to the cardiac cycle reduces motion artifacts, significantly improving the resolution of cellular structures. By interlacing multiple heartbeat triggered imaging scans, it was possible to image large brain volumes with negligible distortion. This approach can be readily incorporated into conventional microscopes to achieve substantial reductions in motion artifacts during two-photon imaging.