Having netted twice in Wednesday's Champions League win over Basel, Ribery showed again what Bayern have been missing this season when he rounded St Pauli's reserve goalkeeper Mathias Hain to wrap up the win in the 79th minute.
Bayern were always in control and took the lead in the first half when Turkey midfielder Hamit Altintop scored an impressive individual goal after beating the St Pauli defence.
Germany defender Philipp Lahm then netted a spot-kick after St Pauli goalkeeper Thomas Kessler was sent off on 68 minutes for fouling Bayern midfielder Thomas Mueller in the penalty area.
Ribery proved his ankle injury is behind him when he wrapped up the win with a well-taken solo effort which leaves his side 14 points behind leaders Dortmund who play Werder Bremen on Saturday evening.
Leverkusen are second in the table after they won 4-2 at Hamburg whose coach Armin Veh is in ever-increasing danger of losing his post.
Two goals by Brazil midfielder Renato Augusto did the damage as Jupp Heynckes side picked up their third straight win as Mainz drop to fourth.
Teenage midfielder Christian Clemens scored his first Bundesliga goal on Saturday when he netted in the 56th minute as Cologne picked up a rare win with a 1-0 victory over Eintracht Frankfurt.
The win lifts Cologne up to 16th in the table.
Hoffenheim were held to a 1-1 draw by Nuremberg while Wolfsburg had a goalless draw at Kaiserslautern.
On Friday, Hanover went third in the table after a 2-1 win over Stuttgart, which looks to have cost Stuttgart coach Jens Keller his job.
The defeat leaves the 2007 German champions 17th -- one from bottom -- in the league and Stuttgart are widely expected to replace Keller with ex-Hamburg coach Bruno Labbadia.
The win came at a price for Hanover as match-winner Didier Ya Konan is out until next year as the Ivory Coast striker damaged knee ligaments after scoring both goals.
Friday's win leaves Hanover third in the table as Ya Konan sealed his side's fifth straight win in the league.
The 26-year-old has now scored nine goals this season, but needs an operation on his right knee on Sunday and will be out until at least mid-January when the Bundesliga returns after the winter break.
Ya Konan is the league's joint third top-scorer.