The eight-time champion survived a testing first set to eventually swat aside the 23rd seed 7-5 6-4 6-2.
Federer served for the first set at 5-4 only for Sonego to break the Swiss great back.
Federer had another break point when the rain came, causing a delay while the roof was closed and, on the resumption, he did not even have to hit a shot to win the game as Sonego double-faulted.
From then on it was plain sailing for the 20-time grand slam champion on Centre Court.
“I’m extremely happy,” he said. “It was tricky conditions inside and outside and Lorenzo is a tough player but I felt after the first set I was able to control things. I couldn’t be more excited to be in the quarter-finals.”
Federer, who turns 40 next month, must wait until Tuesday to find out who his next opponent is.
“These guys are young, they can recover, it’s not a problem for them,” smiled Federer. “Hopefully it rains again – I’m kidding!”