The gut–brain axis refers to the bidirectional communication between the gut and the brain. Four information carriers (vagal and spinal afferent neurons, immune mediators such as cytokines, gut hormones and gut microbiota-derived signalling molecules) transmit information from the gut to the brain, while autonomic neurons and neuroendocrine factors carry outputs from the brain to the gut. The members of the neuropeptide Y (NPY) family of biologically active peptides, NPY, peptide YY (PYY) and pancreatic polypeptide (PP), are expressed by cell systems at distinct levels of the gut–brain axis. PYY and PP are exclusively expressed by endocrine cells of the digestive system, whereas NPY is found at all levels of the gut–brain and brain–gut axis. The major systems expressing NPY comprise enteric neurons, primary afferent neurons, several neuronal pathways throughout the brain and sympathetic neurons. In the digestive tract, NPY and PYY inhibit gastrointestinal motility and electrolyte secretion and in this way modify the input to the brain. PYY is also influenced by the intestinal microbiota, and NPY exerts, via stimulation of Y1 receptors, a proinflammatory action. Furthermore, the NPY system protects against distinct behavioural disturbances caused by peripheral immune challenge, ameliorating the acute sickness response and preventing long-term depression. At the level of the afferent system, NPY inhibits nociceptive input from the periphery to the spinal cord and brainstem. In the brain, NPY and its receptors (Y1, Y2, Y4, Y5) play important roles in regulating food intake, energy homeostasis, anxiety, mood and stress resilience. In addition, PP and PYY signal to the brain to attenuate food intake, anxiety and depression-related behaviour. These findings underscore the important role of the NPY-Y receptor system at several levels of the gut–brain axis in which NPY, PYY and PP operate both as neural and endocrine messengers.