The 34-year-old Italian, who had won just two Grand Slam matches coming into Flushing Meadows, was in the form of his life and pushed Murray all the way for two sets before his legs tired and the Scot's class surfaced, with Murray sealing a 7-6 (4), 5-7, 6-2, 6-3 win at Arthur Ashe Stadium.
Lorenzi served for the first set before Murray broke him back and edged a tiebreaker, and the world No. 2 again was forced to break back from 5-4 down in the second set.
But world No. 40 Lorenzi, who has won 18 Challenger titles, managed to break Murray again and this time served it out to tie the match at one set all.
As the Italian took a comfort break, Murray regripped his racket and regrouped in his chair before racing through the third set. He then closed out the win in 3 hours, 17 minutes.
Murray, bidding to become the fourth man in the Open era to reach all four major finals in a calendar year, next faces Grigor Dimitrov. The Bulgarian continued his quiet progress under Murray's former coach Dani Vallverdu with a 6-4, 6-1, 3-6, 6-2 victory over Joao Sousa.
"It will be a tough match," Murray told ESPN tennis analyst Brad Gilbert on court. "Grigor has been playing well the last few weeks. He's a tough player, moves well. Got a lot of good shots. Very talented guy. Hopefully I play a good match; I'll need to if I want to win."
Juan Martin del Potro kept his comeback rolling along at the US Open with a 7-6 (3), 6-2, 6-3 victory over David Ferrer to move into the fourth round of a major for the first time since 2013.
The 2009 champion returned to Grand Slam competition at Wimbledon this year after missing 2 years of major tournaments because of three surgeries on his left wrist.
A raucous Louis Armstrong Stadium cheered his every winner against the 11th-seeded Spaniard, and he was given a standing ovation at the end of the match. "This crowd, this stadium, this atmosphere is incredible. You make me happy every day," the 6-foot-6 Argentine said in his on-court interview.
Del Potro may be ranked 142nd because of his injury absence, but he is performing like a top-10 player. He was given a wild card into Flushing Meadows after beating both Novak Djokovic and Rafael Nadal in the Olympics before losing to Murray in the gold-medal match.
The Argentine next faces eighth-seeded Dominic Thiem, who overcame a poor start to blast 47 winners in a 1-6, 6-4, 6-4, 7-5 victory over 39th-ranked Pablo Carreno Busta.
Thiem is considered one of tennis' rising young stars and has four titles this season, having also reached the French Open semifinals. The Austrian also made the US Open fourth round in 2014.