Can we control our thoughts? Why do thoughts pop into my head as I'm trying to fall asleep?

—Esther Robison, New York City

Barry Gordon, professor of neurology and cognitive science at the Johns Hopkins University School of Medicine, replies:

We are aware of a tiny fraction of the thinking that goes on in our minds, and we can control only a tiny part of our conscious thoughts. The vast majority of our thinking efforts goes on subconsciously. Only one or two of these thoughts are likely to breach into consciousness at a time. Slips of the tongue and accidental actions offer glimpses of our unfiltered subconscious mental life.

The intrusive thoughts you may experience throughout the day or before bed illustrate the disconcerting fact that many of the functions of the mind are outside of conscious control. Whether we maintain true control over any mental functions is the central debate about free will. Perhaps this lack of autonomy is to be expected as the foundations for almost all the mind's labors were laid long before our ancestors evolved consciousness.

Even deliberate decisions are not completely under our power. Our awareness only sets the start and the end of a goal but leaves the implementation to unconscious mental processes. Thus, a batter can decide to swing at a ball that comes into the strike zone and can delineate the boundaries of that zone. But when the ball comes sailing through, unconscious mental functions take over. The actions required to send him to first base are too complex and unfold too quickly for our comparatively slow conscious control to handle.

We exert some power over our thoughts by directing our attention, like a spotlight, to focus on something specific. The consequences of doing so can be amusing, as in the famous experiments in which about one third of the people watching a basketball game failed to spot a man in a gorilla suit crossing the court. Or the consequences can be disastrous, as when a narrow focus prevents a driver from noticing a light turning red or an oncoming train.

Although thoughts appear to “pop” into awareness before bedtime, their cognitive precursors have probably been simmering for a while. Once those preconscious thoughts gather sufficient strength, the full spotlight of consciousness beams down on them. The mind's freewheeling friskiness is only partly under our control, so shutting our mind off before we sleep is not possible.