Thomas is thought to be the first UK sportsman to go public about living with the condition, and has revealed that he was driven to suicidal thoughts after being told he had the illness by a doctor during a routine sexual health check up.
The former British Lions captain, 45, who will be a TV pundit in the upcoming Rugby World Cup, added that he "broke down" when he got the news of his diagnosis.
Speaking to the Sunday Mirror, he said: "I've been living with this secret for years. I've felt shame and keeping such a big secret has taken its toll.
"I was in a dark place, feeling suicidal. I thought about driving off a cliff. To me, wanting to die was just a natural thought and felt like the easier way out, but you have to confront things."
He explained: "I went for a routine sexual health test at a private clinic in Cardiff. I didn't feel ill and thought everything was going to be fine.
"When (the doctor) said those words... I immediately thought I was going to die. I felt like an express train was hitting me at 300mph.
"Then I was thinking 'how long have I got left?"'
In 2009, when he was Wales’s most capped player, Thomas received praise after becoming the first Rugby Union player to come out as gay - saying at the time that he hoped he could help pave the way for others like him.
- Read more
Now he wants to be able to do the same for his illness, and hopes that his openness will help end the stigma around the condition.
The sportsman now takes one tablet containing four medications each day, and doctors have said his condition is under control to the point that it is considered "undetectable" and cannot be passed on.
Thomas said that his partner - Stephen - who he met after his diagnosis and married three years ago, does not have HIV.
The former rugby star added: "I'm speaking out because I want to help others and make a difference.
"I hope me speaking out about my diagnosis will help a lot of people."
His candour, the day before he is due to compete in the Iron Man Wales competition, has been celebrated by advocates for those living with HIV.
Ian Green, Chief Executive at Terrence Higgins Trust, said: "Gareth is proof that an HIV diagnosis shouldn’t stop you from doing anything you want to do – whatever that is. I hope that by speaking publicly about this Gareth will transform attitudes towards HIV that are all too often stuck in the 1980s.
Support free-thinking journalism and attend Independent events
"We’ve made huge medical advances in the fight against HIV that means that people living with HIV like Gareth now live long healthy lives. We can also say without doubt that those and on effective HIV treatment can’t pass on the virus. This is exactly the kind of information Gareth wants to get out there to challenge the stigma that still surrounds this virus.
"Gareth blazed a trail by being the first rugby player to come out as gay and has done so much to encourage inclusion and diversity within the sport. Now he is doing that once again with HIV and taking on the challenge of a lifetime in Ironman Wales to show that this virus doesn’t need to be a barrier when you’re diagnosed and accessing treatment."
The former Cardiff Blues player won 103 caps and scored 41 tries for Wales between 1995 and 2007, and he is 13th on the all-time international test try-scoring list.
Last November, he was attacked in Cardiff city centre in a homophobic hate crime, but asked South Wales Police to deal with the 16-year-old assailant by way of restorative justice.
You can contact the Samaritans by calling them for free from any phone for free on 116 123, email email@example.com or visit www.samaritans.org to find details of your nearest branch.