Sock defied the odds to qualify for the season-ending tournament for the first time and boosted his chances of reaching the semi-finals with a 5-7 6-2 7-6 (7-4) victory over the fifth seed in Group Boris Becker.
For Cilic, it was the second successive match in which he had led by a break in the final set only to lose, having already done so against Alex Zverev on Sunday.
Federer will play his last round-robin match against Marin Cilic, who he beat in the Wimbledon final earlier this year, while Jack Sock will take on Zverev in a winner-takes-all clash for the right to join the world No 2 in Saturday's semi-finals.
Sock held his nerve when it mattered most to win a thrilling last set tie-break 7-4.
Federer plays Cilic on Thursday afternoon, clearly created to ramp up day-time ticket sales in a tournament shredded by the absence of the injured Andy Murray, Novak Djokovic, Stan Warwinka, Milos Raonic and Kei Nishikori, as well as the less-than-surprising departure of Rafael Nadal after limping to heroic defeat on one good knee against David Goffin on Monday - and Sock plays Zverev in the evening TV slot.
But Zverev is setting tongues wagging after an impressive year in which he has won five tournaments, and Federer was forced to repel three break points against the German as early as the opening game.
"Definitely not a great record, but I felt that I played even well previous year", Cilic said. I'm here to win matches.
"But I love playing here in London, it's an unbelievable atmosphere, you make me feel like home".
"That was a tough one for sure", said the American.
Roger Federer marched into the semifinals of the ATP Finals once again but he made hard work of the task before finally prevailing 7-6 (6), 5-7, 6-1 in a high-quality battle of the generations with Germany's Alexander Zverev.
"I'm not the type of guy that will just enter a draw and be happy to make the third round or the quarters or whatever". We had a 4am fire alarm in our hotel also. "In those three matches that I played, I had good chances at least to win".