Robert Lewandowski's 38th minute opener came against the run of play at the Allianz Arena after Mats Hummels made a stunning last-ditch tackle to deny Branimir Hrgota after he rounded Manuel Neuer.
Frankfurt striker Hrgota missed a glorious chance to equalise before Douglas Costa doubled Bayern's advantage, leaving Lewandowski to bring up his 100th goal for the club 10 minutes into the second period.
RB Leipzig's 1-0 defeat at home to Wolfsburg leaves Ancelotti's men 10 points clear at the summit with as many games to play, but the Italian accepted the match did not always look like proceeding so smoothly.
"It is a good day for us, with good results also in other stadiums," Ancelotti told reporters after the game.
"But the first half was very difficult. Frankfurt were better than us. To be honest, they did not deserve to go in behind at the break.
"In the second half we were better and had the game well controlled.
"We now have a good lead. But we must remain focused. There are still many games. "
Frankfurt have now suffered five consecutive Bundesliga defeats but remain in the hunt for European places in sixth.
Head coach Niko Kovac was left to rue wastefulness in front of goal as his side acquitted themselves impressively in the face of injury and suspension woes
"For 37 minutes we have done very well and posed Bayern problems," he said. "But we do not manage to be in the lead at the moment.
"If you do not take advantage of chances in Munich, you do not have to wonder whether Bayern will be making the goals.
"Nevertheless, we can take much more positives than negatives from this game."