The number of gay and bisexual men being diagnosed with HIV in the UK reached an "all-time high" in 2011, according to the Health Protection Agency (HPA).
It said there had been a "worrying" trend since 2007, with more and more new cases each year.
Nearly half of the 6,280 people diagnosed last year were men who had sex with other men (MSM).
Overall, one in 20 MSM are infected with HIV.
Of those diagnosed in 2011, nearly two-thirds had not been to a sexual health clinic in the previous three years.
The HPA said the figures showed there was "room for improvement" in testing people in at-risk groups.
Dr Valerie Delpech, the organisation's head of HIV surveillance, told the BBC: "Obviously this is a serious illness and it is worrying that we're still seeing a lot in men who have sex with men and this is a record year.
"Transmission in the UK is largely sexual, so safe sex is the best way to prevent yourself getting HIV."
The total number of people living with HIV in the UK rose to 96,000, up from 91,500 the previous year. The issue is most intense in London.
Due to advances in drug treatment, having HIV should not affect life-expectancy.
However, the data suggests that one in four people with HIV are completely unaware of the infection, meaning they cannot receive treatment and may still be spreading the virus.
The chief executive of the National Aids Trust, Deborah Jack, said: "It is vitally important that gay men test at least once a year for STIs [sexually transmitted infections] and HIV, and every three months if they're having unprotected sex with new or casual partners.
"HIV-negative gay men diagnosed with an STI should really treat it as a 'wake up call'. You are at serious risk of getting HIV in the near future and need to take steps to prevent that happening - such as consistent condom use and reduction in number of sexual partners."
Sir Nick Partridge, the chief executive at the Terrence Higgins Trust, said: "HIV is an entirely preventable condition, yet each year we see thousands more people across the UK receive this life-changing diagnosis.
"Reducing undiagnosed HIV by encouraging those in high-risk groups to test more regularly is one way we can put the brakes on the spread of infection."