World number one Federer defeated giant Croatian Ivo Karlovic 7-6, 6-3 in his third round clash while Djokovic overcame Russian Igor Andreev 6-3, 3-6, 6-3 to reach the quarter-finals.
Federer managed to fashion six break points against the six foot 10 inch Karlovic in the first set but each one was saved by booming serves.
Yet in the first set tie-break the Fed-Express made the breakthrough at 5-4 with a brilliant forehand return pass before a netted backhand from Karlovic handed him the set.
In the second set an increasingly dejected Karlovic's serve was not so potent and Federer twice earned 40-0 leads to break twice. Federer was pleased to have overcome this large hurdle.
"It's difficult to judge against Ivo, he has an unbelievable serve, the best in the game," said Federer. "You don't play much on the baseline and you're always under pressure but I'm playing well and feeling good."
Federer faces Czech Radek Stepanek next after he ousted Peruvian qualifier Luis Horna in three sets 6-4, 1-6, 6-3.
Australian Open champion Djokovic survived a marathon battle against Andreev, winning 6-3, 3-6, 6-3 in 2hr 42min and the Serbian third seed will now face Spaniard Nicolas Almagro.
Almagro received a bye after Chilean 12th seed Fernando Gonzalez pulled out of the tournament with a leg injury.
Djokovic did not have things entirely his own way under the Italian sun, quite unlike the stroll he enjoyed in Wednesday's second round against Belgian Steve Barcis.
He took the first set but was broken early in the second and struggled to hold his own serve as his form deserted him.
But Djokovic, who leads the Champions race after his first Grand Slam success at the beginning of the year, found something extra in the decider and scraped through.
Andreev's biggest problem was his failure to take break point chances. He managed to convert only two of 11 opportunities compared to Djokovic's three from five. Djokovic acknowledged he had found it tough against the Russian.
"He plays his best tennis on clay so I'm very happy," said the Serb.
Djokovic and Federer are still scheduled to meet in the semi-finals but the third seed didn't want to look that far ahead.
"I don't know, Almagro is a good player. I've played one more match than him but physically I hope to recover for tomorrow," he said.
It was a good day for American pair James Blake and Andy Roddick who both progressed to the quarter-finals and could yet meet in the semis.
Blake had a tough start against young Spaniard Fernando Verdasco, dropping the first set 7-5 but the eighth seed rallied and took the next by the same score before ropping away with the decider 6-2.
Roddick broke the hearts of home fans as he ousted the last remaining Italian from the draw.
Simone Bolelli started well and broke early in the match but the sixth seed broke back soon afterwards and the first set went to a tie-break with a Bolelli error handing Roddick the set 7-5.
The second was not so close as Roddick's greater experience showed and he took it 6-3.
Read moreAll news
CAC 40®, S&P500®, Eurostoxx50®—what exactly do these stock market indexes reflect? How are...
“The world is going too fast to take time over your invoices”We talk with Sarah Roussel, who heads BNP Paribas Factor
Factoring has become all the rage, carried by new services that are popular with very small...