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 Mr Bolton 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.
I am pleased to announce that, effective 4/9/18, @AmbJohnBolton will be my new National Security Advisor. I am very thankful for the service of General H.R. McMaster who has done an outstanding job & will always remain my friend. There will be an official contact handover on 4/9.— Donald J. Trump (@realDonaldTrump) March 22, 2018
He 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 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.