It was noticed long ago that sleep disorders or interruptions to the normal sleep pattern were associated with various gastrointestinal disorders. We review the studies which established the causal link between these disorders and sleep impairment. However, the mechanism of interactions between the quality of sleep and gastrointestinal pathophysiology remained unclear. Recently, the visceral theory of sleep was formulated. This theory proposes that the same brain structures, and particularly the same cortical sensory areas, which in wakefulness are involved in processing of the exteroceptive information, switch during sleep to the processing of information coming from various visceral systems. We review the studies which demonstrated that neurons of the various cortical areas (occipital, parietal, frontal) during sleep began to fire in response to activation coming from the stomach and small intestine. These data demonstrate that, during sleep, the computational power of the central nervous system, including all cortical areas, is engaged in restoration of visceral systems. Thus, the general mechanism of the interaction between quality of sleep and health became clear.