Bite-one-s-tongue Definition

verb

(idiomatic) To forcibly prevent oneself from speaking, especially in order to avoid saying something inappropriate or likely to cause a dispute.

After the biting, bigoted comments she made about homosexuals, I wanted to scream at her, but I bit my tongue instead.
Wiktionary