Just as he did with the Scottish referendum, David Cameron has also pulled it off in the case of Brexit: the possibility that the UK will leave the EU. He called the referendum to placate his MPs, although he never intended to leave. His negotiations with the EU have been efficient, giving him freedom of action on issues which, in any event, will have to be reformed, like the free movement of citizens.
And so now he is fairly triumphant ahead of the UK June 23 referendum, which he will probably win. He will defeat his surly MPs, who are already divided, making it clear what the economic advantages are of remaining in the European single market, as well as the benefits gained from the negotiations. Apart from still being an influential member.
On the other hand, Brexit would have been damaging for the UK, as well as possibly being the beginning of the end for the EU.