Murray was trying to reach the last 16 at a slam for the first time since his hip problems began in 2017 but, after threatening another vintage comeback, he fell to a 6-4 6-4 6-7 (1) 6-3 defeat on Arthur Ashe Stadium.
The Scot is at least edging back up the rankings and should hit his highest mark since May 2018 at around 43 but his ambitions remain much bigger than that and this is another season where he has been unable to make a mark on the biggest stage.
Murray had talked positively about his fitness and movement after dropping just one set in his first two matches to make it through to the third round in New York for the first time since 2016.
This was a real step up, though. Berrettini has had injury and illness problems himself this year but is a proven performer at the slams in particular.
He had made at least the quarter-finals at the last four major tournaments he has played, although he missed the French Open this year following hand surgery and then Wimbledon, where he reached the final last summer, after an ill-timed bout of Covid-19.
There was little to choose between the pair in the opening set but a double fault from Murray on break point in the seventh game proved the decisive moment.
The Scot then recovered from an early break down in the second and appeared to be gaining ascendancy from the baseline only to again be broken on a double fault, this time at 4-4.
Murray threw his racket towards his chair in disgust as he found himself staring at a two-set deficit.
The 35-year-old had not fought back from two sets down to win a match since a clash with Yoshihito Nishioka here two years ago, which he admitted this week took him months to recover from.
He dug in admirably at the start of the third, saving five break points in his first three service games, and a pumped up Murray yelled in delight when he withstood more pressure to hold for 6-5.
And he got his reward for that tenacity in the tie-break, with Berrettini choosing a bad moment to play his worst tennis of the match, losing seven points in a row.
The comeback really appeared to be on when Murray broke the powerful Berrettini serve in the opening game of the fourth set but the Italian hit back straight away and another lapse from his opponent at 3-4 was the final nail.