He told the BBC's Political Editor Laura Kuenssberg that it was the "very worst time" for Britain to take such an "enormous economic gamble".
But ex-Conservative leader Michael Howard said the UK should have the "self-belief" to go its own way.
He said the EU was "outdated, flawed and failing" and an Out vote would force its leaders to think again.
The prime minister's official spokesman said Mr Cameron had "huge respect for Michael Howard but on this issue they disagree".
The UK will hold a referendum on on 23 June on whether to retain its EU membership or to leave.
Lord Howard, who led the Tories between 2003 and 2005, when he was a close political ally and mentor of Mr Osborne and Mr Cameron, said it was not the PM's fault he had not been able to secure "fundamental and far-reaching reform" of the EU.
He blamed EU leaders for imposing a "rigid straitjacket of uniformity" across the continent.
He told Radio 4's Today programme that, as the world's fifth largest economy, the UK would prosper outside the European Union, arguing that "the Germans would still want to carry on selling us their BMWs and the French would still want to carry on selling us their wine".
"So it is in everyone's interest to want to have an agreement that allows each of us to have access to each other's markets."
Michael Howard was never the most popular politician with the public, but many of his party's grassroots felt he shared their views when he was home secretary. His catchphrase was "prison works".
And perhaps more importantly, they still feel a debt of gratitude for his willingness to take over his party's leadership just after the Conservatives had fallen to a new nadir in the polls under Iain Duncan Smith.
So they will give him a hearing.
If a local Conservative association member is wavering over whether to vote to leave the EU, it will undoubtedly be reassuring to them that they don't have to - in David Cameron's words - "link arms with Nigel Farage".
Instead, they can now grasp the extended hand of friendship from their former leader.
Read more from Iain
Lord Howard rejected suggestions that negotiating a trade-based relationship with the EU, similar to that which Norway and Switzerland have, would leave the UK with the "worst of all worlds" - with reduced access to the single market but still bound by a lot of EU rules and regulations.
"Norway is a country of five million people. We are a country of 65 million people. We won't have Norwegian-style agreement with the EU, we will have a British style agreement.
"We need a bit of self-belief and national self confidence. We are a great country - everyone wants access to our market. We won't be supplicants."
If the UK voted to leave, he suggested it could force EU leaders into negotiating a "different" kind of agreement with the UK, which could then be put to voters in a second referendum - a sequence of events that has been rejected by Mr Cameron as "for the birds".
Speaking in Shanghai, where he is attending a meeting of G20 finance ministers, Mr Osborne told BBC political editor Laura Kuenssberg that the economy faces more risks of uncertainty than at any point since the financial crisis in 2008.
Mr Osborne said talk of leaving the EU was "not some political parlour game", highlighting the recent fall in the value of the sterling to illustrate his point.
"This is about people's jobs and their livelihoods and their living standards, and in my judgement as chancellor leaving the EU would represent a profound economic shock for our country, for all of us and I'm going to do everything I can to prevent that happening."
Mr Cameron will highlight the economic case for membership on a visit to Wales as he continues to tour the UK campaigning to stay in the 28-member bloc.
He will tell voters that nearly half of Welsh trade is with the EU and the nation will be "better off" if the UK remains in.
Chancellor George Osborne has said if Britain voted to leave the EU it would cause a profound economic shock.