A two-dimensional photochemical model which treated the troposphere and stratosphere has been extended to include the mesosphere and lower thermosphere. The model is described, and particular emphasis is placed on the transport and chemistry of nitric oxide. Large amounts of NO are produced in the lower thermosphere both by solar radiation during quiet times and through auroral ionization. Using reasonable descriptions of dynamical processes in the two-dimensional model, substantial amounts of NO produced in the thermosphere can reach the stratosphere, particularly at high latitudes during polar winter. This process provides a coupling between the upper and lower atmosphere which may play a significant role in the photochemistry of odd nitrogen and odd oxygen in the stratosphere.