Controlling and sensing spin states of magnetic molecules at the single-molecule level is essential for spintronic molecular device applications. Here, we demonstrate that spin states of Co-porphyrin on Au(111) can be reversibly switched over by binding and unbinding of the NO molecule and can be sensed using scanning tunneling microscopy and spectroscopy (STM and STS). Before NO exposure, Co-porphryin showed a clear zero-bias peak, a signature of Kondo effect in STS, whereas after NO exposures, it formed a molecular complex, NO-Co porphyrin, that did not show any zero-bias feature, implying that the Kondo effect was switched off by binding of NO. The Kondo effect could be switched back on by unbinding of NO through single-molecule manipulation or thermal desorption. Our density functional theory calculation results explain the observations with pairing of unpaired spins in d(z2) and pp pi* orbitals of Co-porphyrin and NO, respectively. Our study opens up ways to control molecular spin state and Kondo effect by means of enormous variety of bimolecular binding and unbinding reactions on metallic surfaces.