After the Prime Minister made a last ditch appeal for support, the House backed the proposals by a big margin of 400 to 175.
However, with Labour and Liberal Democrats strongly in favour, it was clear that scores of Tories had taken advantage of the free vote to register their opposition.
The Labour Whips office suggested that 139 Tories had voted against the Bill, with 132 in favour. Dozens more did not vote.
The result followed more than six hours of stormy debate on the Marriage (Same Sex Couples) Bill.
Culture Secretary Maria Miller said it would make Britain "a fairer place to live", and insisted religious organisations which did not want to conduct gay marriages had protection.
But Tory MPs lined up to condemn the measures - including the chairman of the backbench 1922 Committee Graham Brady, who said he had "serious misgivings" over assurances on religious freedom.
Former defence minister Sir Gerald Howarth said that the Government had no mandate for such a "massive social and cultural change", which was not mentioned in the Conservative manifesto for the 2010 election.
Speaking in Downing Street less than two hours before the crunch vote, Mr Cameron accepted that there were "strong views on both sides of the argument".
But he said: "I am a strong believer in marriage. It helps people commit to each other and I think it is right that gay people should be able to get married too.
"This is, yes, about equality. But it is also about making our society stronger.
"I know there are strong views on both side of the argument - I accept that. But I think this is an important step forward for our country."
Mr Cameron did not attend the debate, but Downing Street had indicated that he would be voting.
Deputy Prime Minister Nick Clegg said after the vote:
“I genuinely believe that we will look back on today as a landmark for equality in Britain. Tonight’s vote shows Parliament is very strongly in favour of equal marriage.
“No matter who you are and who you love, we are all equal. Marriage is about love and commitment, and it should no longer be denied to people just because they are gay.
“The Liberal Democrats have long fought for equal marriage. It is party policy and I am proud that the Liberal Democrats are part of the Coalition Government that are making it happen.
“I especially want to pay tribute to Lynne Featherstone, whose dedication and tenacity have been critical to making this happen.”