This paper presents a theoretical and numerical study on the heat conduction of gas confined in a cuboid nanopore, in which there exists a temperature difference between the top and bottom walls and the side walls are adiabatic. A modified gas mean free path in confined space is proposed by considering the impact of collisions between molecules and solid surfaces, with which an effective thermal conductivity model of gas in the transition regime is derived. A direct simulation Monte Carlo (DSMC) study on the heat conduction of argon and helium in a cuboid nanopore is carried out to validate the present model. The influences of the Knudsen number and the treatments of boundary conditions on the heat conduction and effective thermal conductivity of gas in nanopores are studied. The temperature jumps and the reduction of heat flux near side walls are analyzed.