The 23-year-old, who came through the club's academy, has admitted that he "wouldn't want to be anywhere else".
"Bath is my home and I'm extremely pleased to have extended my contract. The environment here is fantastic and is certainly one in which a player will develop. I wouldn't want to be anywhere else," Mercer told reporters at a press conference.
Head coach Gary Gold added: "Guy is a very impressive young man. He is Bath born and bred, and he plays and trains as if this Club means everything to him.
"We believe he has what it takes to be a major part of this Club's future and we are delighted to have extended his contract."
Mercer has made 59 appearances for the club.