McGahee, who gained 163 yards on 19 carries, established a Miami single-season rushing touchdown record with his 18th and 19th ground scores of the year. But the Hurricanes had to come up with a key second-half turnover and then fight off a late surge to extend their winning streak to 32 games.
Pittsburgh quarterback Rod Rutherford almost sent the game into overtime, but with 30 seconds remaining he overthrew wide open receiver Yogi Roth in the end zone on fourth and five from the Miami 20-yard line.
The Hurricanes (10-0) need a win next week at Syracuse and another one at home on Dec. 7 against Virginia Tech to secure a spot in the national championship game, which will be played in the Fiesta Bowl.
Ohio State, the only other unbeaten team in the country, can earn a berth in the title contest Saturday with a victory at home against Michigan.
Pittsburgh (8-3) overcame an early 7-0 deficit to take a 14-7 advantage late in the first half. But on the first play after the Panthers went in front, McGahee stormed up the middle and dashed 69 yards for the touchdown that tied the game at halftime.
Pittsburgh followed that burst by taking seven minutes off the clock and driving inside the Miami five-yard line. But Rutherford fumbled the ball away to bring an end to a fruitless, 80-yard drive.
McGahee capped off an 80-yard Miami march with a nine-yard run that made it 28-14 with 1:24 gone in the fourth quarter -- a score that seemingly put the game away.
But Rutherford took the Panthers 73 yards in eight plays, completing five of five passes on the march, and scored on a four-yard run to bring Pittsburgh within seven points with 4:41 remaining.
Pittsburgh shut down Miami on the Hurricanes' ensuing possession and the Panthers took over at their own 42 with a chance to pull off the biggest upset of the college football season. The Panthers picked up three first downs and reached the Miami 25 with a minute to play.
Two incompletions and a five-yard pass to Larry Fitzgerald, however, left the Panthers with a fourth down play that they could not convert.
Miami scored first on a 78-yard punt return by Sean Taylor at the end of Pittsburgh's opening possession of the game, but the Panthers rallied on touchdown passes from Rutherford of six yards to Fitzgerald and three yards to Roosevelt Bynes.
"It was a great football game by our team and a phenomenal effort from Pittsburgh," said Miami Coach Larry Coker, who is 42-0 since taking over the program. "But that is what we expected -- a tough, four-quarter football game.
"At halftime, we told them we had played good defense, but we had to make plays on offense. We felt if we played Hurricanes football, we would be fine."
Celebrity Families of 2014 [PHOTOS]