Mind wandering (MW) is a subjective, cognitive phenomenon, in which thoughts move away from the task towards an internal train of thoughts, possibly during phases of neuronal sleep-like activity (local sleep, LS). MW decreases cortical processing of external stimuli and is assumed to decouple attention from the external world. Here, we directly tested how indicators of LS, cortical processing and attentional selection change in a pop-out visual search task during phases of MW. Participants brain activity was recorded using magnetoencephalography, MW was assessed via self-report using randomly interspersed probes. As expected, the performance decreased under MW. Consistent with the occurrence of LS, MW was accompanied by a decrease in high frequency activity (HFA, 80-150 Hz) and an increase in slow wave activity (SWA, 1-6 Hz). In contrast, visual attentional selection as indexed by the N2pc component was enhanced during MW with the N2pc amplitude being directly linked to participants’ performance. This observation clearly contradicts accounts of attentional decoupling that would predict a decrease in attention-related responses to external stimuli during MW. Together, our results suggest that MW occurs during phases of LS with processes of attentional target selection being upregulated, potentially to compensate for the mental distraction during MW.