By Tom Bergin and Melissa Akin

LONDON/MOSCOW (Reuters)- BP bowed to demands from its partners in TNK-BP and eased its grip on Russia's third-largest oil producer on Thursday to end a bitter dispute that had knocked BP's shares and rattled investor confidence in Russia.

TNK-BP's top management, including BP-nominated Chief Executive Bob Dudley, will be replaced, independent directors will be added to the board and the owners will consider floating 20 percent of the joint venture.

BP shares rose 4 percent on news of the framework deal.

BP and Alfa Access Renova (AAR), the vehicle that represents the four Russia-connected billionaires who own 50 percent of TNK-BP, said the deal would be finalized in the coming months.

"This would be a much better outcome for BP than the market has been anticipating," Richard Griffith at Evolution Securities said.

Investors had feared the hostile battle for control of TNK-BP might lead to BP losing interest in the joint venture, which analysts said was worth $45 billion, with only minimal compensation.

BP Chief Executive Tony Hayward said the terms agreed meant it retained key protections BP agreed five years ago, although its effective management control over TNK-BP had been weakened.

"We've made some modest adjustments to give the company a little more freedom," BP Chief Executive Tony Hayward told Reuters in a telephone interview.

"We think this provides the platform for the next phase in its (TNK-BP's) development and we look forward to continuing to grow," he added.

Hayward said he hoped recent attacks on TNK-BP, including raids on its offices by security forces and tax probes, which had prompted Dudley to flee Russia citing a campaign of harassment, would now become less of a problem.

Russia's deputy prime minister Igor Sechin, a close ally of Prime Minister Vladimir Putin and chairman of state-controlled Rosneft , was quoted in AAR 's statement as praising the partners for resolving their differences themselves.

"We support TNK-BP's development and believe this company has excellent long-term prospects," Sechin said.

FEWER LEGAL PROBLEMS

The feud, combined with a government attack on a blue-chip steel company and Russia's brief war in Georgia, contributed to Russia being one of the world's worst performing markets in the second half of 2008 so far, despite booming commodities exports.

BP accused its partners of behaving like corporate "raiders" from Russia's chaotic 1990s when asset stripping and partner dilution was common. The Soviet-born billionaire co-owners, led by Mikhail Fridman, in turn accused BP of running TNK-BP like a subsidiary and Dudley of favoring BP interests.

Some analysts had believed the dispute was a precursor to a state-controlled Gazprom or Rosneft taking a controlling stake, in line with the Kremlin's drive in recent years to bring Russia's oil wealth under its control.

Alexander Branis, a director at Prosperity Capital, said the agreement showed the dispute was "commercial and not due to pressure that foreign investors experience in Russia."

Dresdner Kleinwort oil analyst Colin Smith said the deal represented a defeat for the Russian partners who had sought to wrest control and value from BP.

Hayward said there was a lesson for other investors: "It demonstrates that you can do business in Russia provided you are robust about how you do it ... From time to time you have to take the gloves off."

He added that two of the four billionaires who own 50 percent of TNK-BP, Viktor Vekselberg and German Kahn, may lose senior management roles at TNK-BP following the deal.

Khan oversees TNK-BP security and government relations, and BP said his refusal to seek visas for foreign employees and BP secondees had inflamed the company's problems with authorities.

SHARES RECOVER

BP shares fell back after an initial surge to trade up 0.54 percent at 508.75 pence at 1458 GMT, outperforming a 0.7 percent drop in the DJ Stoxx European oil and gas sector index.

Analysts said the stock had previously discounted almost the total value of TNK-BP.

"Since February, BP has underperformed Royal Dutch Shell by 12 percent in US dollars, despite a 10 percent earnings rerating relative to Shell," Citigroup oil analyst Mark Bloomfield said in a research note.

Shares in TNK-BP Holding , a listed subsidiary which owns the majority of TNK-BP's assets, rose 18 percent at one point before falling back to trade up 8 percent.

Analysts at UniCredit Aton said TNK-BP would receive a boost if it proceeded with the share float which is being considered.

This would see TNK-BP put its assets into a new subsidiary, up to 20 percent of which would be floated on a market abroad, while TNK-BP remained jointly owned by BP and the billionaires.

"A back of the napkin estimate suggests a 10 percent to 21 percent effect on the company's valuation," the brokerage said in a research note.

TNK-BP's board, where each side has half the seats, will be restructured. In future, each side will appoint four directors, and three independent directors will hold the balance.

A BP spokesman said the agreement would have no impact on BP's reserves and that a future spin-off of part of TNK-BP's assets would only reduce its reserves on a pro-rata basis. TNK-BP accounts for just under a fifth of BP's proven reserves.

(Additional reporting by Dmitry Zhdannikov and Tanya Mosolova in Moscow; Editing by Quentin Bryar/Rory Channing)