Gordon Brown pledged to stand with gay people until "justice was achieved".
The prime minister said progress had been made because the Government had "fought together" with the lesbian, gay, bisexual and transsexual community.
Speaking at a reception at 10 Downing Street last night, he promised not to give up on the campaign.
"We reaffirm our commitment, my commitment, the commitment of the Government to standing with you all until the full range of gay rights are achieved," he said.
"When we started as a Government on this journey, people said the dreams that we had together were impossible."
Mr Brown singled out steps taken in the last decade, including lifting the ban on lesbians and gay men serving in the armed forces, allowing same sex couples to have civil partnerships and to adopt.
He said: "We did all these things and more because we stood and fought together.
"Let me promise you I will not give up on the fight for justice until justice is achieved.
"The road to equality is always long and it's always hard and it's always tough.
"But as long as Harriet (Harman) and I and other ministers are able to work with you, I promise you that nobody ever need walk the road to equality alone."
The reception was hosted by the Prime Minister and his wife Sarah to celebrate LGBT history month.
A number of members of the armed forces attended, in honour of the 10-year anniversary of the ban being lifted, along with celebrities including comedian Paul O'Grady, actor Antony Cotton and Strictly Come Dancing judge Craig Revel Horwood.
Asked about the significance of an invitation to an event at Number 10 for gay people, O'Grady said: "I was standing having a shave earlier and I thought Oscar Wilde would be turning in his grave.
"It would never have happened. Even 20 years ago it was unthinkable.
"It shows you what great steps have been made."
Cotton, who plays Sean Tully in Coronation Street, said: "It's an important and very special event for us.
"We are very lucky in this country in some ways because we finally have the right to get married and to live equal lives.
"But unfortunately in other countries there are people who are killed for being who they are. That's unacceptable, so the fight continues."
Mr Brown spoke of the "debt of gratitude" owed to British service personnel as he addressed the guests.
Leading Logs Lee Fadden, 26, based at HMS Nelson in Portsmouth, said: "I feel very proud. I think it's a landmark - to be at No 10 celebrating LGBT history.
"It's only going to help make things more equal."
Mr Brown also congratulated a policeman on his civil partnership a fortnight ago - which came four months after he was injured in a homophobic attack.
Pc James Downey-Parkes, 22, was off duty when he was assaulted during a night out in Liverpool city centre in October, suffering multiple skull fractures and fracturing his cheekbone and eye socket.
Pc Downey-Parkes said he and 21-year-old Tom, a healthcare assistant, were "shocked" when they found out the prime minister would mention them.
"I feel over the moon to be here," he said. "I never thought I would be at an event like this."
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies