The 33-year-old, 17-time Grand Slam winner was pushed to three sets in the previous round by German hope Philipp Kohlschreiber but had fewer problems with Gulbis.
The Swiss will now meet Germany's Florian Mayer who defeated American Steve Johnson 6-3, 7-6 (7/4).
Defending champion Federer has reached the final of the last nine editions of the grass court Wimbledon tune-up, winning seven.
The iconic right-hander took advantage of one of his two break opportunities to snatch the first set and never looked back as he broke at 6-5 in the second to set up a winning chance.
He closed out the match in style as he improved his record for the season to 30 wins against six defeats just days after losing a Roland Garros quarterfinal against eventual champion and compatriot Stan Wawrinka.
Federer joked that he was in better form than world number one Novak Djokovic — the man he lost against in last year's Wimbledon final.
"Yes, because I've won two matches on grass and he hasn't won any yet," said the Swiss in reference to Djokovic's decision not to play a grass-court event before Wimbledon.
"Kidding aside, yes, I hope to be competitive," he said.
"I hope I'm going to be in good shape. I hope we play against each other (at Wimbledon)."
Federer has won 85 tournaments in a glittering career, including three this season at Brisbane, Dubai and Istanbul.