In a rare House of Commons defeat for Cameron, MPs voted 317-286 to reject the government's plans.
At least 20 Conservative MPs are understood to have rebelled.
Labour and the SNP had said they would vote against the government's proposals.
Small shops can currently open when they want to on Sundays, but larger stores are limited to six hours between 10am and 6pm.
The government had proposed giving councils in England and Wales the freedom to decide if larger stores can stay open for more than six hours on Sundays.
The business department released figures earlier today showing that extending Sunday trading hours would benefit the UK economy by an estimated £1.5bn over 10 years.
The Federation of Small Businesses (FSB) welcomed tonight's vote in the Commons, saying it was a "major win for small businesses across England and Wales".
"Our members have been unconvinced of the economic case for relaxing Sunday trading rules and there has been no impact assessment to support the proposals," FSB policy director Mike Cherry said, adding, "The FSB calls on ministers to listen to the views of small businesses and the House of Commons on this issue."
“The current system can be seen as a great British compromise which allows families to spend time together, employees to work if they wish to, and provides much needed support for smaller retailers within their communities."
But the New West End Company, which represents more than 600 retailers in central London, disagreed, calling the Commons vote "very disappointing".
“This was an opportunity to re-energise our high streets and, as our independent polling showed, was supported by retailers and workers alike," said the group's chief executive Jace Tyrrell. "The economic evidence in favour of extended hours is clear: £260m every year and the equivalent of 2000 new, full-time, jobs would be created in the West End and Knightsbridge alone with just two extra hours every Sunday.
“The economic factors that made this proposal necessary now will only get stronger over time, so while we accept and respect today’s result, we hope that it will be reconsidered by parliament in the future," Tyrrell added.
The Institute of Economic Affairs (IEA), meanwhile, rejected the move, saying the current rules are "both restrictive and outdated".
"The government's plan to devolve power down to local councils on this issue would have been a step in the right direction, as local authorities are best placed to determine the needs of their local areas in this area of policy," said IEA director general Mark Littlewood.
"The UK's retail sector has been flat for many years now. In an age where our high street stores are battling against Internet giants such as Amazon, relaxing trading laws would help give stores the ability to compete on a level playing field."
The British Council of Shopping Centres (BCSC) – a retail property industry group with more than 2,500 members – said the vote was "farcical" and blamed the SNP for blocking the changes, which only apply to shops in England and Wales.
"Anti-reform campaigners’ stance about threats to community life are misplaced," said Edward Cooke, director of policy and public affairs at BCSC.
"Sundays will always be special for people for different reasons," Cooke added. "However, communities don’t exist on a single day of the week and shopping is often a communal activity."
Labour had campaigned against the government's proposals with a "keep Sunday special" tagline.