The Ireland and Leinster fly-half will move to the Cherry & Whites for next season.
Bath have prised Santiago Carreras away from West Country rivals Gloucester by signing the Argentina international on a three-year deal.
Gloucester coasted to a 31-7 European Challenge Cup victory over Scarlets at Kingsholm.
Harlequins head coach Danny Wilson accepted his side “weren’t at the races” as they finished scoreless for the first time in over a decade in a 14-0 defeat to Gloucester
Gloucester earned a deserved 14-0 win over an out-of-sorts Harlequins before a sell-out crowd at Kingsholm.