The intercostal nerves are part of the somatic nervous system, arising from the anterior (ventral) roots of the thoracic spinal nerves from T1 to T11. The intercostal nerves are distributed to the thoracic and abdominal walls, including the parietal pleurae (and parietal peritoneum). They differ from the anterior roots of the cervical, lumbar and sacral spinal nerves in that each pursues an independent course without plexus formation.
The intercostal nerves control the contraction of the intercostal (striated skeletal) muscles and carry somatic sensory information from the skin and parietal pleurae (and parietal peritoneum). Nerves from the autonomic nervous system innervate the smooth muscles of the thoracic viscera and carry visceral sensation from the visceral pleurae (and visceral peritoneum).
There is a major difference between somatic and visceral sensation. Damage to the internal wall of the thoracic cavity that injures the parietal pleura is somatic sensation that can be felt as a sharp pain localized in the injured region. Damage to the visceral pleura is experienced as an un-localized ache.