The resolution of Single Molecule Localization Microscopy (SML) is dependent on the width of the Point Spread Function (PSF) and the number of photons collected. However, biological samples tend to degrade the shape of the PSF due to the heterogeneity of the index of refraction. In addition, there are aberrations caused by imperfections in the optical components and alignment, and the refractive index mismatch between the coverslip and the sample, all of which directly reduce the accuracy of SML. Adaptive Optics (AO) can play a critical role in compensating for aberrations in order to increase the resolution. However the stochastic nature of single molecule emission presents a challenge for wavefront optimization because the large fluctuations in photon emission do not permit many traditional optimization techniques to be used. Here we present an approach that optimizes the wavefront during SML acquisition by combining an intensity independent merit function with a Genetic algorithm (GA) to optimize the PSF despite the fluctuating intensity. We demonstrate the use of AO with GA in tissue culture cells and through ~50µm of tissue in the Drosophila Central Nervous System (CNS) to achieve a 4-fold increase in the localization precision.