Stomach cancer is a global health issue because of its incidence and mortality rates worldwide. We developed a near-infrared (NIR) emissive ratiometric two-photon (TP) probe (HCC1) for the quantitative analysis of pH in live cells and human stomach tissues. The probe design is based on a restrained hemicyanine core that controls the intramolecular charge transfer from 2-naphthol, with a suitable pKa value (7.50) under physiological conditions. The probe exhibited improved quantum yield, stability, and TP activity under physiological conditions. In addition, intracellular pH titration (pH 4.0 to 10.0) of HCC1 revealed an ideal intracellular pKa of approximately 7.2, negligible cytotoxicity, and TP excited fluorescence in situ, thereby allowing direct imaging of the cellular pH in live cells and tissues. Ratiometric two-photon microscope imaging with HCC1 of human stomach tissue revealed a clear intratissue pH variation among normal, adenoma, and cancer tissues. Our results demonstrate that HCC1 is useful as an NIR imaging probe for in situ pH-related studies and in cancer research.