As an alternative method for the compensated neutron porosity measurement method, the neutron-gamma porosity measurement method is widely used in cased holes. However, the neutron-gamma porosity measurement method has some problems, such as the lack of detailed theoretical analysis and low sensitivity in high-porosity formations. The purpose of this paper is to clarify the theory of neutron-gamma porosity measurement, improve the measurement sensitivity, and eliminate the effects of environmental factors. Based on the neutron diffusion theory and the gamma transport theory, the distribution of capture gamma rays is described. A new neutron-gamma porosity measurement method is developed based on inelastic and capture gamma-ray distribution. The applicability of the new method in different environments is analyzed using the Monte Carlo method, and the effectiveness of this method is verified using the synthetic model. The results indicate that the capture gamma-ray ratio is only related to the source-detector distance, gamma-ray attenuation length, and neutron migration length. By combining density, different neutron cross sections, inelastic gamma-ray count ratio, and capture gamma-ray count ratio, the parameter secondary gamma-ray hydrogen index (SGH) related to hydrogen index can be extracted. The dynamic range of SGH is much higher than thermal neutron count ratio and the capture gamma-ray count ratio. The errors in porosity calculation by this method under different borehole and lithologic conditions are generally less than 2 pu. The calculation error of this method is close to that of the compensated neutron porosity measurement method. In addition, the applicability of the new method is analyzed without density data, and the results indicate that the calculation results are basically consistent with the results of calculation with density data. The new method has great potential for extensive applications in cased holes or open holes as an alternative for the compensated neutron porosity logging measurement method.