The prime minister made his historic announcement in Downing Street after briefing the cabinet.
He said he would be campaigning to remain in a reformed EU - and described the vote as one of the biggest decisions "in our lifetimes".
Ministers immediately divided up into the leave and remain camps as the campaigns got under way in earnest.
The referendum date announcement comes after renegotiations on the UK’s relationship with Europe were finalised on Friday night after intense wrangling at a two-day summit in Brussels.
The agreement, which will take effect immediately if the UK votes to remain in the EU, include changes to migrant welfare payments, safeguards for Britain’s financial services and making it easier to block unwanted EU regulations.
Some Conservative MPs have announced their intention to back the prime minister. The Labour Party, SNP, Plaid Cymru and the Lib Dems are also in favour of staying in.
But many Conservatives have announced they will back the leave campaign including Mr Cameron’s long-time ally, Justice Secretary Michael Gove.
London Mayor Boris Johnson, who has previously been a Eurosceptic, has yet to declare where he stands.
On Sunday, he is expected to confirm he will campaign for out, but has told friends he is genuinely conflicted, BBC political editor Laura Kuenssberg says.
Number 10 is resigned to him opposing them following a meeting this week, at which he was disappointed with Mr Cameron’s plans, our editor adds.
Mr Johnson has also discussed his decision with Mr Gove.
According to the latest opinion polls, the British public are thought to be fairly evenly split.