Having been outplayed for the best part of three sets, Murray threatened a comeback when he saved two match points and extended the clash into a fourth set.
But, in only his seventh match since back surgery, the Scot did not have the stamina to take it to a decider and Federer won 6-3 6-4 6-7 (6/8) 6-3 after three hours and 20 minutes.
This tournament has shown the Swiss can be a force at the highest level again and he moves through to an 11th consecutive semi-final, where he will meet old foe Rafael Nadal.
As well as holding two match points in the third-set tie-break, Federer also served for the match in that set only for Murray to hit back.
But the British number one gave his opponent a second chance when he dropped his serve at 3-4 in the fourth, and this time Federer took it.
Murray said: "I gave him the break at the end of the match. That was disappointing. In the first two sets I thought he played great tennis.
"When he was serving for the match I felt like I raised my level because I had to basically, and I obviously prolonged the match a bit further.
"I just wasn't able to get ahead in the fourth set. I was proud of the way I fought.
"That's the highest level I've played at in a long time. My serve slowed down a bit in the fourth set, especially the first couple of points when I was getting up after the change of ends.
"But I hung in well. I pushed through it and almost got myself back in the match."
Murray had surgery on a long-standing back problem last September and spent the rest of 2013 trying to get himself in the right shape to compete at a grand slam.
He played only two competitive matches in the build-up and went into the tournament unsure how he would fare.
Quarter-finals has to be seen as a success, particularly given the level he showed against Federer, although the Scot will drop out of the top four in the rankings on Monday.
"I've come a long way in four months," said Murray.
"Obviously right now I'm very disappointed. There's a few things I would have liked to have done differently. There's maybe some things I would have done a bit differently if I was ever to have surgery again possibly.
"But it's the first time I ever went through something like that. I thought I did a good job getting myself in good shape to be competitive at this level. I wasn't too far away in the end.
"I was able to push very hard for three and a half hours. It was a very high-quality, high-intensity match.
"Obviously Roger plays a pretty high tempo, so the points are fairly quick-fire, the ball's coming at you quickly. I dealt with that fairly well.
"With a few things that you can tweak here and there, maybe I could have found a few extra per cent."
Federer has a new bigger-headed racquet and a new man in his corner in Stefan Edberg, and there is a renewed confidence about the 32-year-old.
The back problems that dogged him last season appear to be a thing of the past, and it was only his failure to finish off the match in the third set that took any shine off his performance.
He said: "It would have been nice to close it out, it being that solid a match that I played.
"The thing was not only that I served for it, but I had 6-4 and 5-2 in the breaker. There's so many things I could have maybe done better. I maybe got slightly passive.
"You sit down and you're still in the lead. You don't know if momentum is still on your side or on his side now. Only the next few games will decide that. So it was important to get the lead straight away again.
"I could sense that he was struggling shortly after that. But then again, you don't know how serious it is. Is he just doing it now and he's going to be okay later when it matters?
"I've been in these positions before. For me it was just a matter of staying calm and forgetting about it a little bit because the match was great until that point."