EU interior ministers have agreed that phone records must be kept for at least 12 months, and e-mail data for at least six, to help the fight against terror.
Mr Clarke said governments would go ahead without MEPs if necessary
At a meeting in Luxembourg, they mandated UK Home Secretary Charles Clarke to negotiate with the European Parliament to get its agreement.
The parliament has argued that such a law would violate civil liberties.
Mr Clarke said governments would pass a law without MEPs' involvement unless there was a deal by December.
A compromise proposal put forward by the British presidency of the EU offers an olive branch to parliament, suggesting that the retention period could be capped at two years.
It also says that each state can decide for itself how the industry should be compensated for the costs involved.
The decision comes after years of debate about the cost of such measures and their impact on civil liberties, as well as disagreement about the length of time data should be stored.
Officials say no record will be kept of the content of phone calls or e-mails, only the sender, recipient, time, place and length of any communication.
The legislation would apply to unanswered as well as answered calls.
EU ministers agreed that measures of this kind were necessary at an emergency meeting just after the 7 July London bombings.
The UK home secretary later told them that telephone data had been invaluable in the investigation into the attacks.
Impatience with MEPs
"We have to decide who we are most afraid of - the European Parliament or terrorists," diplomats quoted Danish Justice Minister Lene Espersen as saying.
"If Parliament can't help [to get an agreement], then they are not adult enough to take part in the discussion," she reportedly said to applause from other ministers.
Mr Clarke said: "We have reaffirmed that we will have agreement on measures to deal with telecoms data by the end of the British presidency.
"We have agreed we will seek to join the European Parliament in that approach if we can."
Ireland, Britain, France and Sweden originally proposed that the member states should decide among themselves on the legislation, by taking what is known as a "framework decision".
However, the European Commission has also drafted legislation, which would require the support of the European Parliament.
Currently, data retention laws vary widely from country to country within the 25-member EU.
Fifteen have no law in the area at all.
Ireland and Italy already have laws obliging telecoms companies to keep data for three and four years, respectively.
EU officials said these countries would be exempted from the two-year cap proposed for the rest of the EU.
The European Parliament has threatened legal action if the governments try to pass a law without a parliamentary vote.