John cheated on Mary by texting another person behind her back. Sherlock implies that he has done this, too. He sometimes texts The Woman. But, why would texting The Woman similar to what John did? Why would that be cheating? Because John is his de facto boyfriend, obviously.
Here we’re being explicitly told that emotional involvement without physical intimacy is a romantic entanglement. John and Sherlock are deeply emotionally involved. Just like John cheated on Mary, Sherlock sometimes cheats on John with The Woman (by flirting with her).
This idea is reinforced by having John stand under, ‘the horns’, at Baker Street. To, ‘put the horns’, on somebody means to cheat on them.