"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.
Top 14
France scrum-half Tillous-Borde extends Toulon deal
14/02/2015 AT 11:54
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.
Top 14
All Black Conrad Smith moving to France after World Cup
06/02/2015 AT 01:56
Top 14
Wilkinson signs off in style with Toulon win
31/05/2014 AT 21:09