Three-photon (3P) microscopy enables functional imaging at greater depths in the mammalian brain than any other technique with single-cell resolution, owing to greater penetration ability. One of the main challenges of such imaging is tissue-induced optical aberration, which inevitably reduces the excitation confinement at depth. Adaptive optics systems, by using deformable mirrors or other wavefront-shaping devices to compensate for optical distortions, enable real-time correction of these aberrations. In this study, we present a practical adaptive optics-assisted 3P imaging system optimized for in vivo functional recordings in the mouse cortex during behaviour. We introduce a hierarchical, three-level aberration correction strategy that sequentially targets aberration caused by the microscope system, the cranial window, and tissue depth. We demonstrate the application of this aberration correction strategy in two anatomically distinct regions: the prelimbic cortex, adjacent to the superior sagittal sinus, and the somatosensory cortex as a representative lateral cortical area, highlighting how aberration sources vary with imaging geometry. Adaptive optics significantly improved imaging performance in both contexts: restoring cellular visibility adjacent to large vascular structures in the prelimbic cortex, and enhancing signal-to-noise ratio during deep imaging in the lateral somatosensory cortex. Together, our work provides a practical framework for implementing adaptive optics-assisted 3P imaging and optimizing deep in vivo functional imaging performance across diverse cortical environments.