Mr Cameron said the "prize" of an improved membership package was "closer than it was"
David Cameron has insisted the "best answer" for the UK is to stay in a reformed European Union as he said he was hopeful of securing a renegotiation deal next month.
The British prime minister said the "prize" of an improved membership package was "closer than it was", but indicated he was ready to delay the in-out referendum until next year if an agreement could not be finalised in February.
Mr Cameron also refused to be drawn on whether he would impose restrictions on in-work benefits to young Britons in a bid to stop the "almost unnatural draw" of the UK's welfare system for European migrants.
Speaking on the BBC's Andrew Marr Show, Mr Cameron said of his attempt to negotiate a new relationship with Brussels: "It's hard work.
"I am hopeful of a deal in February and if we do that we can go ahead and hold the referendum. My aim is clear. Best of both worlds for Britain.
"The massive prize of sorting out what frustrates us about Europe but staying in a reformed Europe."
He added: "To me the substance matters much more than the timing so if I can't get the right deal in February I will wait and keep going and keep plugging away because it is such an important issue for our country.
"I think the best answer for Britain is staying in a reformed European Union if we can get those changes but as I have said before if we don't get them I rule nothing out."
Asked whether the British government was preparing contingency plans for the UK to leave the EU, Mr Cameron said: "I don't think that is the right answer for the reasons I have given.
"Were that to be the answer we would need to do everything necessary to make that work.
"The civil service are working round the clock to support my negotiation."
Mr Cameron said his proposal of a four-year ban on in-work benefits for migrants, seen as one of the most difficult demands to secure, was "still on the table", but he was open to any alternative that would be "equally powerful".
Pressed if there could be a compromise where British citizens were also subject to the restriction and then compensated with a "social" payment, Mr Cameron said: "I am in the middle of a negotiation.
"I have got hard work to do and when I have an announcement to make I will make it."
The prime minister ruled out resigning if the country voted for the UK to leave the EU.
He also said it had "always been my intention" to allow eurosceptic ministers to campaign for a so-called Brexit in a "personal" capacity.