Control of the charge state of the nitrogen-vacancy (NV) center is crucial because of its instability and its transitions between the negative (NV–) and neutral (NV0) NV charge states under laser irradiation In this study, we fabricated an n-i-n junction, with an i-layer sandwiched between two phosphorus-doped n-layers; then, we measured the charge state of NV centers under steady state and laser irradiation in a known band structure where the Fermi energy changes gradually. The steady-state charge state measured by a nondestructive single shot exhibited stable NV– and NV0 signals when the Fermi level was even slightly above and below the transition level, respectively. This result indicates that the charge state can be significantly stabilized through band engineering. Both charge-state populations were observed only when the Fermi level was close to the transition level. Under continuous green laser irradiation, the ratio of NV– measured by the photoluminescence spectra changed gradually with the Fermi level in the depletion layer because of the balance between excitation from the laser and the supply of charge from the band. This outcome agrees reasonably with the calculated bands. Furthermore, we measured the PL spectra of the ensemble NV centers and discovered that their charge state can be well-controlled, as in the single NV center. The charge state of the i-layer at the interface can be stabilized by depositing a thin n-layer on the surface. These results would contribute significantly to improve sensor performance.