In the Commons, he was asked if he could ever imagine Britain quitting the union.
"All futures for Britain are imaginable. We are in charge of own destiny, we can make our own choices," he replied, adding that a British departure was "not my preference".
He said: "I believe the choice we should make is to stay in the EU, to be members of the single market, to maximise our impact in Europe, but where we are unhappy with parts of the relationship we shouldn't be frightened of standing up and saying so."
The remarks are the first in which Mr Cameron has conceded the possibility of Britain leaving an organisation it joined in 1973. He spoke amid continuing debate in the Conservative Party and across Europe about Britain's future in the EU.
A growing number of Conservative MPs want the party to commit to a referendum that would offer voters a choice between a renegotiated "common market" membership of the EU and outright departure.
Mr Cameron has not yet set out his position on the issue, although he has said that he does not want Britain to leave, warning that the country could end up in a position like that of Norway – bound by EU rules but unable to influence them.
He said he would set out his long-term vision for Britain's relationship with the rest of the EU in a major public speech. The speech has been repeatedly delayed. Mr Cameron told MPs that he would finally deliver it "in the middle of January".
Ed Miliband, the Labour leader, said Mr Cameron had lost control of Britain's destiny.
"The drift in his party and the direction of his policy mean we are sleepwalking towards exit."
His comments follow remarks by London Mayor Boris Johnson that leaving the EU would not be "the end of the world" for Britain. (©Daily Telegraph, London)