Wimbledon winner Murray dispatched French 11th seed Jo-Wilfried Tsonga 6-4, 6-1 while second seed Djokovic gave away a second-set point in a sporting gesture to Tommy Robredo during a 6-3, 7-5 triumph.
Britain's sixth-seeded Murray, who trails the Serb 8-11 in their all-time rivalry, was looking forward to a repeat match with Djokovic after not playing him since last July.
"We've played a lot and we always have long, tough matches. This will be a good test for me," Murray said.
Federer was on fire against Gasquet, who set up two Federer match points with a backhand error and took the loss moments later as he could not reach a drop shot in the windy conditions.
More From This Section
"The wind was the same for both of us, but I've had a lot of experience playing in it," said Federer. "I made him work for his points.
"It was a great match for me and I'm very pleased," said Federer, who broke five times and committed only eight unforced errors.
Murray, who underwent back surgery six months ago, improved to 9-1 against Tsonga, advancing in 74 minutes.
The Scotsman, who converted on eight of his 12 break chances, won on his second match point as the Frenchman hit the net with a return.
"It was a close match," Murray said. "I had lots of break points. Conditions were tricky with the wind. It was not pretty tennis but we tried the best we could.