In the ultimate betrayal, Dr. Phil McGraw‘s wife Robin is writing a tell-all book that exposes  his darkest secrets, sources say.

Robin’s "warts-and-all" memoir about their 32-year marriage could bring her a whopping $3 million advance, according to publishing insiders.

"Phil believes he’s being betrayed," a friend of the 58-year-old TV shrink told The ENQUIRER. "But at the same time, he feels he’s almost powerless to stop Robin!

"Their marriage has been on shaky ground for some time, and he thinks that if he demands she not write the book, she will dump him for good."

And the self-help guru has plenty of reason to worry, said another source.

"Robin reveals how Phil has humiliated her by his cheating and lying," a friend of 55-year-old Robin told The ENQUIRER.

"She’s also written about their secret divorce deal – which is already done – and disclosed the real reason he hates his talk-show mentor Oprah Winfrey!"

Robin has already hit the best-seller list twice with self-help books.

"A tell-all would be a natural progression for her," her friend pointed out. "And since their marital problems have already been exposed, it makes perfect sense that now would be the time to put it out there."

Robin already writes about the couple’s ups and downs on the Dr. Phil show Web site, and she recently revealed that they discussed divorce less than a year into their marriage.

As The ENQUIRER has reported, that woman was a 19-year-old college student. Phil first treated her in 1984 when he was 34. The woman has said that he became sexually abusive a year into their relationship, when she began working for him as an intern. The woman eventually reported Phil to the Texas State Board of Examiners of Psychologists, which determined he’d engaged in unprofessional conduct.

"When Phil reached a settlement with the group’s board, and was publicly reprimanded, Robin felt humiliated, cheated on and lied to," said her friend.

Robin’s manuscript also reveals that the couple has already worked out a secret divorce pact, said her friend.

According to the standard divorce laws in California, where the couple have lived since 2002, Robin is entitled to half her husband’s earnings – a whopping $200 million payday, said the source.

 "Phil knows Robin wants the success of a best-seller, but he’s confident he can dissuade her by giving her a payoff equal to the potential $3 million book advance she’d reap," his friend told The ENQUIRER.

"Phil can be very convincing, and he’s telling her it’s what’s best for their marriage. He thinks she’ll take the loot – ‘crazy money’ he calls it – and forget all about turning the manuscript into a book."