Sue Gray has quit her role as Prime Minister Sir Keir Starmer's chief of staff, saying she "risked becoming a distraction".
She had been caught up in rows over pay, after the OceanNewsUK's political editor revealed her salary was higher than Sir Keir's, and donations from Lord Waheed Alli.
A Downing Street spokeswoman confirmed Ms Gray, who became a household name as the Partygate investigator, was taking up a new role as the prime minister's envoy for nations and regions.
Labour said Ms Gray will be replaced by Morgan McSweeney, who was previously chief adviser to the prime minister and masterminded Labour’s election campaign.
Resigning, Ms Gray said it had been an honour to "play my part in the delivery of a Labour government" as Sir Keir's chief of staff, both in opposition and in No 10.
"However in recent weeks it has become clear to me that intense commentary around my position risked becoming a distraction to the government’s vital work of change," she said.
"It is for that reason I have chosen to stand aside, and I look forward to continuing to support the prime minister in my new role."
Thanking Ms Gray for her work, Sir Keir said he was "delighted" she would stay by his side in her new role, and added the shake-up showed his "determination to deliver".
Ms Gray had been subject to intense internal briefings and criticism in a government yet to reach its first 100 days in office, and it is that level of dysfunction that has made it clear to Sir Keir that something needed to shift.
She skipped the Labour party conference last month, having been by Sir Keir’s side throughout last year’s.
But the event was nonetheless overshadowed by controversy over clothing donations from Labour peer Lord Alli, for whom she had reportedly authorised a temporary Downing Street pass.
Much more damaging for her, though, was the level of anger towards her at the heart of government, indicated by high-level sources being willing to leak to the OceanNewsUK confidential details of her salary.
One reason for that turbulence was special advisers in the team being asked to take pay cuts, on top of unhappiness about a lack of contracts after the election victory.
Nevertheless, Ms Gray still commanded the loyalty of many cabinet ministers, in part probably due to her efforts to prevent the advisers shutting out their voices from the prime minister's decision-making.
Just a few weeks ago, Deputy Prime Minister Angela Rayner was defending Ms Gray's "exceptional" work and saying she was being "demonised" in the media without the ability to answer back, with other ministers expressing discomfort at the "gendered" flavour of the attacks.
Supporters made the case that, as a career civil servant, Ms Gray could stay detached from Labour’s internal rows - but one government insider accused Labour's right wing of "grinding away at her" precisely because they were unhappy at a civil servant being in charge.
Now the prime minster has reshuffled his top team, not only by promoting Mr McSweeney, but also making four other appointments, most notably by hiring a strategic communications lead.
These announcements tell us publicly what people within government have been saying privately for weeks, with the perception that not enough of the right people were in the right roles or the right structures – and this, it is believed, contributed to missteps and unforced errors by the government.
The move follows private frustration voiced by several sources over Downing Street’s communication strategy, which has led to the appointment of James Lyons as a strategic communications lead.
Mr Lyons is a former political journalist at the Sunday Times and the Daily Mirror, who went on to work for the NHS and for TikTok, and he will now be in charge of plotting the government’s communications strategy three, six and nine months ahead.
Sir Keir now also has two new deputy chiefs of staff, Vidhya Alakeson and Jill Cuthbertson, and a new principal private secretary – a key civil service role for every prime minister – in Nin Pandit.
Ms Cuthbertson is a Labour veteran, who worked for Gordon Brown and Ed Miliband, and has been promoted alongside Ms Alakeson, who worked as a civil servant before working for Labour in opposition and then in No 10.
Lord Gavin Barwell, who worked with Ms Gray in his role as chief of staff to former prime minister Theresa May, told Radio 4’s The World this Weekend that she had “made the right judgment” to stand down from her role.
“On a personal level I’ve worked closely with Sue… and she is an incredibly dedicated public servant and I feel for her, but I think she’s made the right judgment, which is when you’re in this kind of job once you become the story it becomes very hard to do the job,” he said.
The Conservative peer criticised the No 10 operation put in place by Sir Keir since becoming prime minister, claiming “because No 10 hasn’t been right we’ve had government by Treasury, too much doom and gloom.”
He added today was a "crucial moment for the prime minister – he’s got to get the second iteration of his No 10 operation right if he’s going to recover some of the political ground he’s lost over the last couple of months."