The all-time record for total team home runs in one game is ten. It has only been done one time when on September 14, 1987, the Blue Jays hit ten homers against the Orioles. It's not impossible for this record to be broken, but it would take the right set of circumstances.
The Yankees' record for most home runs in one game isn't too far away from the all-time record with eight, which they have accomplished twice. June 28, 1939 against the Philadelphia Athletics was the first of those occasions. Philadelphia's starter that day was Lynn Nelson. Bill Dickey was the first Yankee to homer that day, leading off the second inning with one. In the third inning, Nelson allowed homers to Joe DiMaggio, George Selkirk, and Babe Dahlgren. After allowing a single to Yankees' starting Monte Pearson, the A's took Nelson out.
Philadelphia's second pitcher of the day was Bill Beckmann. After getting out of Nelson's mess in the third inning, Beckmann didn't do much better in the fourth. He allowed a second home run to DiMaggio and gave one up to Joe Gordon. Beckmann wouldn't even see out the fourth inning. In his one total inning pitched, he managed to allow eight runs on seven hits.
The Athletics then turned to Bob Joyce. Joyce would finish off the game for the Athletics, pitching 5.1 innings. However, he too gave up some home runs. In the sixth, he gave one up to Tommy Heinrich, and then allowed one last Yankees' home run in the seventh: a second for Babe Dahlgren.
Through all that, Monte Pearson threw a complete game, allowing just two runs on seven hits. The Yankees won 23-2.
The most recent of these games was on July 31, 2007. Facing former Yankee Jose Contreras, the offense struck pretty quickly. Bobby Abreu and Hideki Matsui both hit home runs off Contreras in the first inning, giving the Yankees a 4-0 lead. After the White Sox actually cut the lead to just one run, Robinson Cano homered off Contreras, chasing him from the game.
Chicago put in Charlie Haegar to pitch. Just two batters after he was brought in, Melky Cabrera homered off him. Haegar lasted just 1.1 innings, allowing another home run Jorge Posada in the process.
The third pitcher the White Sox tried was Gavin Floyd, but that didn't go all that different. In his second inning of work, Floyd allowed a second home run to Matsui. In the seventh inning, he gave up another two: one to Johnny Damon and one to 2007 phenom Shelley Duncan.
The White Sox switched pitchers one last time in the eighth inning. In the one inning they faced him, the Yankees couldn't get to him. In a 16-3 loss, only one Chicago pitcher managed to hold the Yankees scoreless that day. It was Boone Logan.
All data courtesy of the Baseball-Reference Play Index