The Frenchman opened the scoring after just three minutes before Mario Gomez doubled the hosts' advantage with his 21st goal of the season as Bayern brushed aside their Spanish opposition.
Jonathan de Guzman halved the deficit with a fine strike after the break as Villarreal eventually found their feet but Ribery then restored Bayern's two-goal advantage.
Bayern Munich have been in scintillating form in the Champions League this season and went into the game top of the group on 10 points, three ahead of City and having won 10 of their last 11 home games in Europe.
Villarreal, on the other hand, were languishing bottom of the group without a single point from four games.
And the form book rang true from kick-off, with Carlos Marchena gifting the hosts possession midway inside his own half, with the excellent Toni Kroos then slipping the ball to Ribery, who coolly chipped past Diego Lopez in the Villarreal goal.
Bayern Munich smelt blood on their beleaguered opponents and immediately looked to go two ahead when Anatoliy Tymoshchuk picked up a loose ball near the back post but could only shoot into the side netting.
Villarreal were left chasing shadows against a Bayern team full of confidence, stroking the ball away with consummate ease while waiting for the right pass to unpick the visitors' defence.
And Arjen Robben soon beat the offside trap but the Dutchman, who recently returned from injury, failed to control the ball under pressure from Joan Oriol and eventually hit a tame shot straight into the arms of the grateful Lopez.
It took 18 minutes for Villarreal to register their first attempt, with Angel Lopez's speculative volley from outside the box drifting harmlessly wide.
Normal order was restored after that rare foray forward and Bayern's lead was extended when Tymoshchuk unleashed a fierce shot from 25 yards which thundered off the post and fell to Gomez, who made no mistake in poking home for his sixth Champions League goal of the season.
Villarreal sparked into life as half-time approached and de Guzman saw his low cross fly across the face of goal, while Borja Valero's 20-yard shot was well-saved by Manuel Neuer, who was a virtual spectator for the previous 39 minutes.
That set the tone for the start of the second half and Villarreal pulled a goal back when Oriol broke down the left flank and chipped a cross to the back cross which de Guzman lashed home on the volley.
Four-time champions Bayern looked to immediately restore their two-goal advantage, with Ribery seeing his spectacular scissor kick go inches wide.
And Ribery missed a golden chance just seconds later, evading the Villarreal offside trap but missing the target with a free header from Robben's cross.
But the former Marseille attacker got his second with 20 minutes remaining after Villarreal gave away possession in their own half, leaving Kroos to slip in the 28-year-old, who coolly took the ball round Lopez and fired home to seal the deal.
- Related links