Prime minister texted Brooks in the week she quit over the phone-hacking scandal to tell her to keep her head up

David Cameron texted Rebekah Brooks in the week she quit as News International's chief executive over the phone-hacking scandal to tell her to keep her head up, it has been claimed in an updated biography of the prime minister.

In a sign of his closeness to some of the most controversial News International chiefs, Cameron told Brooks that she would get through her difficulties, just days before she stood down.

It has also emerged that he agreed to meet her at a point-to-point horse race so long as they were not seen together, and that he also pressed the Metropolitan police to review the Madeleine McCann case in May last year following pressure from Brooks.

The prime minister then sent an intermediary to Brooks to explain why contacts had to be brought to an abrupt halt after she resigned. The authors say the gist of that message was: "Sorry I couldn't have been as loyal to you as you have been to me, but Ed Miliband had me on the run."

The revelation comes in the week that Cameron's closeness to Brooks will come under intense scrutiny when she gives evidence to the Leveson inquiry on Friday. It is not known whether precise details of her text exchanges will be published by the inquiry, but it is thought that at certain points she was in repeated daily text contact.

The day before Brooks's evidence session, the former News of the World editor Andy Coulson will also give evidence, including how he came to be appointed as director of communications for the Conservative party.

Cameron has admitted that he and other politicians became too close to too many newspaper proprietors and executives.

Following a ruling by the Leveson inquiry last week, the prime minister is being given early access to the evidence being submitted to the inquiry. He will be studying her evidence and preparing a counter-strategy.

The evidence of the text comes in a revised biography of Cameron written by Frances Elliott and James Hanning and titled Cameron: Practically a Conservative.

The book also claims that the Cabinet Office minister Oliver Letwin acknowledged that the clutch of News International bosses such as Brooks could be very demanding. He is quoted by the authors as saying: "If you are on the same side as her, you have to see her every week. This was how it worked."

Letwin told the authors how the Conservatives viewed Brooks. "The realpolitik is that you have to get on with people who run newspapers. Labour did the same.

"If you are on the same side as her, you have to see her every week. This was how it worked. It was what was demanded if you wanted them on your side.

"All of us should have said, 'We'll have nothing to do with them and we'll only meet them when we absolutely have to'. But the problem with that is if the other guy is doing it ... it's an arms race. I don't think this was a love affair based on a misjudgment. I think it was a carefully calculated view of what you had to do in order to carry the people onto our side. That game is over, thank God."

In a further sign of the relationship between Brooks and Cameron, the authors claimed that as Cameron prepared for a meeting with her, Ed Llewellyn, his chief of staff, told him: "Your turn next, Dave. Wear kid gloves."

The book also claims that royal courtiers told Cameron's team that Buckingham Palace would think poorly of a decision to take Coulson into Downing Street. They had previously been pacified by the understanding that he would leave Cameron's side after the election.

Downing Street sources told the Times that the decision on the McCann case had been taken on its merits. "This was something the government believed in. Just because a newspaper champions a cause doesn't mean it's not the right thing to do."

Sources close to Brooks also told the Times that she would not be commenting ahead of her appearance before Lord Leveson.

• This article was amended on Wednesday 9 May 2012 to correct typographical errors that crept in during the editing process.