The No. 2-ranked Federer dominated earlier in the day, defeating Benoit Paire 7-5, 6-4, 6-4 at Arthur Ashe Stadium. Later on, No. 6-ranked Djokovic beat the United States' Tennys Sandgren in four sets.
Federer advances to the Round of 32 to take on Australia's Nick Kyrgios, who rallied to take three straight sets against Pierre-Hughes Herbert after losing in the opening set on Thursday. Djokovic will take on Richard Gasquet, who outlasted Laslo Djere 6-3, 7-6, 6-3 in the second round.
No. 7 Marin Cilic and No. 4 Alexander Zverev moved on to the Round of 32 after strong performances. Cilic defeated Hubert Hurkacz soundly -- 6-2, 6-0, 6-0 -- while Zverev upended Nicolas Mahut in three sets.
In women's action, No. 2 Caroline Wozniacki joined No. 1-ranked Simona Halep in suffering a shocking defeat. Wozniacki lost 6-4, 6-2 to Ukraine's Lesia Tsurenko -- who is ranked No. 36 -- in the second round of play.
Wozniacki is the reigning Australian Open champion, but has now exited in the second round of two consecutive majors. She endured a similar second-round departure at Wimbledon this year.
No. 11 Daria Kasatkina's impressive season ended prematurely after losing to Aliaksandra Sasnovich in two sets. She had reached the quarterfinals in both the French Open and Wimbledon this year.
Caroline Garcia -- ranked No. 6 -- got around Monica Puig in three sets, and No. 5 Petra Kvitova defeated Wang Yafan 7-5, 6-3. No. 22 Maria Sharapova beat Sorana Cirstea 6-2, 7-5 in the final match of the day.