Swiss second seed Federer beat Marcel Granollers of Spain 6-2 7-6 (7/1) 6-3 in front of a packed crowd on Court Suzanne Lenglen that included Angus Young, the guitarist of veteran Australian rock band AC/DC.
Federer got the job done in one hour, 47 minutes, although he was broken twice and his opponent made life tough in the second set in particular.
The 2009 champion eventually came through a tiebreak before running away with the third set and will now meet Damir Dzumhur of Bosnia, who knocked out experienced Cypriot Marcos Baghdatis for a spot in the last 16.
"I still had long hair at the time. I don't know if he remembers. It is a real pleasure to see him here."
Also Read
Sharapova, who was also champion at Roland Garros in 2012 and runner-up in 2013, defeated Diatchenko 6-3 6-1 in the first match on Court Philippe Chatrier to set up a clash with former finalist Samantha Stosur in the third round.
The second seed exchanged breaks with her Fed Cup teammate early on but went on to win the opener 6-3, Diatchenko double-faulting on set point.
Stosur of Australia, the runner-up in 2010 who is seeded 26th this year, breezed past French wildcard Amandine Hesse 6-0 6-1 on Court Suzanne Lenglen.