The 26-year-old has been with the Warriors since joining as a raw 17-year-old back in 2004 and made his debut in the November of that year against the Borders before amassing 146 appearances for Warriors in the ensuing nine years.
But now Barclay has decided to search for pastures new and head coach Townsend said: "John has been a fantastic player for the club. He will be with us until the end of the season and is now back to full match fitness following his recent hamstring injury.
"It is great to be able to call on a player of his ability and experience for what could be the most important games in the club's history."
Barclay, left, said: "The club has been a huge part of my life since I turned professional and I'd like to thank everyone associated with the club for their support over the last nine years.
"I'm looking forward to being involved in some big games before the end of the season."