President Donald Trump is replacing national security adviser HR McMaster with John Bolton, a former US ambassador to the United Nations.
Mr Trump tweeted that Mr McMaster has done "an outstanding job & will always remain my friend." He said MrBolton will take over on April 9.
The president has repeatedly clashed with Mr McMaster, a respected three-star general, and talk that he would soon leave the administration had picked up in recent weeks.
His departure follows Mr Trump's dramatic ousting of Secretary of State Rex Tillerson last week.
It also comes after someone at the White House leaked that Mr Trump was urged in briefing documents not to congratulate Russian President Vladimir Putin about his recent re-election win. Mr Trump did it anyway.
Mr McMaster was brought in after Mr Trump's first national security adviser Michael Flynn was dismissed.
Mr Flynn was sacked because he did not tell White House officials, including Vice President Mike Pence, about the full extent of his contacts with Russian officials.
In a statement released by the White House, Mr McMaster said he would be requesting retirement from the US Army effective from this summer, adding that afterwards he "will leave public service".
The newly appointed national security adviser said he aims to make the US "safer at home and stronger aboard".
In a statement posted on Twitter, Mr Bolton said: "It is an honour to be asked by President Trump to serve as his national security adviser. I humbly accept his offer.
"The United States currently faces a wide array of issues and I look forward to working with President Trump and his leadership team in addressing these complex challenges in an effort to make our country safer at home and stronger abroad."
The White House said Mr McMaster's exit had been under discussion for some time and stressed it was not due to any one incident.
Mr Bolton, probably the most divisive foreign policy expert ever to serve as UN ambassador, has been a hawkish voice in Republican foreign policy circles for decades.
He met Mr Trump and White House chief of staff John Kelly in early March to discuss North Korea and Iran. He was spotted entering the West Wing earlier on Thursday.