WASHINGTON—President Donald Trump, stepping up his efforts to bring the Russia investigation to a conclusion, has hired longtime ally and former New York City Mayor Rudy Giuliani as part of the legal team representing him in the probe.

Mr. Giuliani is joining the team amid bubbling tensions between the Justice Department and the White House.

Mr. Trump has called for a swift conclusion to the investigation and in recent weeks lashed out at the two top officials overseeing it, special counsel Robert Mueller and Deputy Attorney General Rod Rosenstein, leading people close to the president to believe he might dismiss them.

Both men have told the president that he isn’t a target of the investigation, but Mr. Trump has been angered by the probe’s broad scope and its focus on several close associates.

The addition of Mr. Giuliani, who has a decadeslong relationship with Mr. Mueller, could ease some of those tensions.