O'Leary won the Six Nations Grand Slam in 2009 and was a two-time Heineken Cup winner while playing for Munster.
He joined London Irish from Munster in 2012, and completed his career with French team Montpellier.
"I have had an incredible career from my academy days in Munster to my last game in Montpellier," said O'Leary, who played 24 times for his country.
O'Leary, who started four games in Ireland's Grand Slam, was named in the 2009 British and Irish Lions squad but did not tour because of a broken ankle.
He won the Heineken Cup in 2006 and 2008.
O'Leary said: "I have realised my ambition of representing Munster and Ireland - wearing the red and green jerseys has been a real honour.
"Highlights that stand out are the two Heineken Cup victories with Munster and winning the Grand Slam in 2009 with Ireland.
"However, the most fulfilling experience is the unique bond and friendships I experienced through rugby. This camaraderie is what I will miss the most."
Grand Slam-winning Ireland and Montpellier scrum-half Tomas O'Leary has retired at the age of 33.