The capacity to adapt to resource distributions by modulating the frequency of exploratory and exploitative behaviors is common across metazoans and is arguably a principal selective force in the evolution of cognition. Here we (1) review recent work investigating behavioral and biological commonalities between external foraging in space and internal foraging over environments specified by cognitive representations, and (2) explore the implications of these commonalities for understanding the origins of the self. Behavioural commonalities include the capacity for what is known as area-restricted search in the ecological literature: this is search focussed around locations where resources have been found in the past, but moving away from locations where few resources are found, and capable of producing movement patterns mimicking Lévy flights. Area-restricted search shares a neural basis across metazoans, and these biological commonalities in vertebrates suggest an evolutionary homology between external and internal foraging. Internal foraging, and in particular a form we call embodied prospective foraging, makes available additional capacities for prediction based on search through a cognitive representation of the external environment, and allows predictions about outcomes of possible future actions. We demonstrate that cognitive systems that use embodied prospective foraging require a primitive sense of self, needed to distinguish actual from simulated action. This relationship has implications for understanding the evolution of autonoetic consciousness and self-awareness[Current Zoology61 (2) : 368–381, 2015 ].