Pericytes have myriad functions in cerebrovascular regulation but remain understudied in the living brain. To dissect pericyte functions in vivo, prior studies have used genetic approaches to induce global pericyte loss in the rodent brain. However, this leads to complex outcomes, making it challenging to disentangle the physiological roles of pericytes from the pathophysiological effects of their depletion. Here, we describe a protocol to optically ablate individual pericytes of the mouse cerebral cortex in vivo for fine-scale studies of pericyte function. The strategy relies on two-photon microscopy and cranial window-implanted transgenic mice with mural cell-specific expression of fluorescent proteins. Single pericyte somata are precisely targeted with pulsed infrared laser light to induce selective pericyte death, but without overt blood-brain barrier leakage. Following pericyte ablation, the changes to the local capillary network and remaining pericytes can be examined longitudinally. The approach has been used to study pericyte roles in capillary flow regulation, and the structural remodeling of pericytes involved in restoration of endothelial coverage after pericyte loss.