A first-half mistake allowed Thomas Muller in to find Mario Gotze at the far post and he tapped home for his third goal in two games.
David Alaba had a big hand in the second, forcing Halfar to turn the ball into his own net under pressure in the 66th minute, compounding a difficult match for the midfielder.
Manuel Neuer made a superb double-save before half time, but was largely untested by a much-changed Cologne side, who are still yet to find the net at home this season.
The result leaves Pep Guardiola's men top of the Bundesliga, having extend their unbeaten start to the season to six games.
The return of Arjen Robben coincided with a 4-0 win for the champions over Paderborn on Tuesday, and the Dutchman was lively again during the opening exchanges at the RheinEnergieStadion.
A jinking run into the area saw the winger brought down by Halfar inside five minutes, only for referee Knut Kircher to wave away any penalty appeals.
Muller fired wide two minutes later as the visitors, who came into this game having only won once in their last three trips to the Rhine club, sought an early advantage.
And Cologne's defence, which conceded their first goal of the season at Hannover in midweek, was eventually undone after 19 minutes.
Halfar's error allowed Robben to play in Muller, whose drilled ball across the goal eventually found Gotze at the far post, enabling the German to tap home with a simple finish.
Muller nearly added a second four minutes later, forcing a great save from Timo Horn following Robert Lewandowski's lay-off, before Robben tested the keeper again with curling effort in the 33rd minute.
The visitors' inability to find a second was nearly punished 10 minutes before the break, with Neuer on hand to deny Adam Matuszczyk and Anthony Ujah in quick succession.
Jonas Hector fired wide seven minutes later, but Bayern continued to look the better side, despite seeming content to spend most of the second half simply keeping possession.
Having allowed Bayern to take the lead through his first-half error, Halfer's misery was complete when he turned the ball into his own net.
Some good work from Robben allowed Lewandowski to break free in the box, setting up Alaba, who was then tackled by Halfar, before the ball trickled into the net.
Substitute Xabi Alonso almost capped off the triumph 19 minutes from time, but the Spaniard was denied his first goal for the club as his 30-yard effort was saved by Horn.