Clegg acted as cover for the Scots during the Rugby World Cup period last year, scoring 48 points in five appearances.
After four months he had moved on to Oyonnax, but with three options at No.10 all on duty with Scotland, Townsend knows luring him back earlier than expected has been a real coup.
"He had already agreed a one-year deal for next season," he said.
"But, with Finn Russell getting injured against France and both Duncan Weir and Peter Horne with Scotland, we're delighted to get Rory here early.
"He did very well during his time with us at the start of this season and we expect him to settle quickly and compete hard for the fly-half spot.
"His style of play fits very well with how we want to take the game to the opposition and his kicking from hand and at goal is of a very high level.
"It will be great to work with him again."
To buy tickets for the GUINNESS PRO12 Grand Final click here. Also follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the GUINNESS PRO12.