"We've been in touch with Phillips's entourage for months, hoping to sign him for next season," the top-14 team said on their website (www.racing-metro92.com) on Monday. "What recently happened with Bayonne just brought forward his arrival."
After his sacking the 31-year-old received support from Wales coach Warren Gatland who started him in November tests against South Africa, Argentina and Australia.
Phillips is his country's most capped scrumhalf with 80 appearances including all five games in the 2008 and 2012 Six Nations grand slam.
He has also toured the Southern Hemisphere twice with the British and Irish Lions.
At Racing he is joining compatriots Jamie Roberts and Dan Lidyate who were among the club's high profile signings of the close season.