Lawmakers in the lower House of Commons were expected to approve the bill following a marathon debate on Monday, which saw Cameron join forces with Labour to defeat a "wrecking amendment" backed by dozens of rebellious right-wingers from his Conservative party.
Their amendment to allow straight couples to form civil partnerships would have heavily delayed the bill, but MPs opposed it by 375 votes to 70.
They instead backed a Labour plan to discuss the rebel proposition further without blocking the main part of the legislation.
After Tuesday's vote the bill will pass to the upper house of parliament, the House of Lords, where it is expected to face stiff opposition in a further headache for Cameron.
The debate has sharply divided lawmakers, with Conservative former minister Norman Tebbit stoking controversy by claiming gay marriage could result in a lesbian queen giving birth to an heir by artificial insemination.
"When we have a queen who is a lesbian and she marries another lady and then decides she would like to have a child and someone donates sperm and she gives birth to a child, is that child heir to the throne?" Tebbit said in an interview with The Big Issue magazine.
Despite the parliamentary wrangles, Britain has seen none of the mass protests over gay marriage held across the channel in France, which last weekend became the 14th country in the world to legalise it.
Some 54 percent of Britons are in favour of allowing same-sex couples to marry, according to a YouGov poll for the Sunday Times.
The rancour over gay marriage within the Conservatives has heaped further pressure on Cameron, who is already facing bitter opposition from many Tories over his leadership style and a promised referendum on Britain's EU membership.
The prime minister was forced to send a mass email to Conservative activists late Monday after an unnamed ally reportedly called them "mad, swivel-eyed loons".
"I am proud of what you do. And I would never have around me those who sneered or thought otherwise," he wrote.
The "loons" comment fuelled accusations that Cameron is out of touch with traditional Tories and that the prime minister surrounds himself with people from his own privileged background.
Party co-chairman Lord Andrew Feldman, who strongly denies rumours he was behind the comment, was a schoolmate of Cameron's at the elite Eton College.
Many Conservative supporters fear that with a general election two years away, Cameron's backing for gay marriage is driving traditional Tory voters to the UK Independence Party (UKIP).
The anti-immigrant, anti-EU party is a fast-rising force in British politics and made strong gains in local elections last month.
UKIP leader Nigel Farage said Tuesday he would not expel members for voicing "old-fashioned" views about homosexuality, after reports that one of the party's candidates branded gay sex "disgusting" on an online forum.
A new poll suggested that support for the Conservatives has slumped to 24 percent -- just two percent ahead of UKIP -- although a different poll put the Tories on 31 percent.
Last week, more than a hundred Conservative MPs took the unprecedented step of backing a motion expressing regret that the government's legislative plans for the year contain no guarantee of a referendum on EU membership, which Cameron has promised for 2017.
Lawmakers are allowed a free vote on gay marriage, meaning they are not required to follow party directions because it is considered an issue of conscience.
MPs were expected to approve the bill on Tuesday by a comfortable margin, despite the opposition of many Conservatives. When it was last debated in February, almost half voted against it.
Providing the bill passes through the Commons, it will then move to the House of Lords for further scrutiny. The bill is set to be presented in the Lords on Wednesday but they will not begin debating until June 3.