SHP2 protein, a nonreceptor type protein tyrosine phosphatase, is a crucial signal transduction regulator. It interacts with key signaling molecules in the RAS/ERK and PD-1/PD-L1 pathways and significantly affects cell proliferation, differentiation, and immune regulation. It is a promising target for cancer therapy and plays a role in the progression of various tumors. In this study, we report the design and synthesis of near-infrared (NIR) small-molecule fluorescent probes for the recognition and labeling of SHP2. These probes exhibited superior optical properties, strong target affinity, and high selectivity for SHP2. The top-performing probe, SHP-PP2, demonstrated an IC50 of 0.86 μmol/L against SHP2 activity and a Kd of 0.91 μmol/L in binding studies, indicating its potent inhibitory effect and binding affinity. In summary, these probes can effectively enable the visualization of SHP2 in living cells and tissue sections, thereby facilitating further research on SHP2.