Roddick, who announced last week this tournament would be his last, fell during the afternoon to Juan Martin del Potro in their rain-delayed quarterfinal match, and Federer lost in a late-night meeting with Tomas Berdych.
Federer won the U.S. Open five times in a row beginning in 2004, and this is the first time in nine years he has not reached at least the semifinals.
Berdych eliminated the world No. 1 Federer 7-6 (7-1), 6-4, 3-6, 6-3 and will now meet Olympic champion Andy Murray in the semifinals.
Second-seeded Novak Djokovic advanced with a fourth-round victory, the 11th straight match win for the defending champion in New York. He posted an easy 6-4, 6-1, 3-1 decision over 18th-seeded Stanislas Wawrinka, who retired in the third set.
Djokovic will now face del Potro, who bested Roddick 6-7 (1-7), 7-6 (7-4), 6-2, 6-4.
Roddick, who for most of this century has been the top-ranked player from the United States, ended his career with one major championship -- that coming in this tournament in 2003.
"For the first time in my career I'm not sure what to say," a tearful Roddick said on the court after the match. "I've loved every minute of it."
He was the second major figure in the world of tennis to end a career in this tournament. Three-time U.S. Open champion Kim Clijsters had also announced this would be her final event, and she lost in the second round to Britain's Laura Robson.
Murray prevailed over No. 12 Marin Cilic 3-6, 7-6 (7-4), 6-2, 6-0. He shook off a sluggish second set and fired 11 aces to win the nearly 3-hour match.
Also Wednesday, eighth-seeded Janko Tipsarevic wrapped up a 6-3, 7-6 (7-5), 6-2 win over No. 19 Philipp Kohlschreiber in another match that began Tuesday but was interrupted by rain. Tipsarevic now fill face David Ferrer in the quarterfinals.