Earlier in the fourth quarter, Nathan Jones' second sack of the game on first-and-10 from the Dolphins 15-yard line eventually forced the 49ers to settle for former Dolphin Joe Nedney's third field goal.
This marked the third consecutive game the Dolphins held their opponent without a touchdown.
The offense, though, struggled badly in the second half after scoring twice in the first.
Chad Pennington completed all six of his pass attempts in the first quarter, in the process breaking the team record of 15 consecutive completions.
Pennington's third completion came on the first drive and went for 61 yards to tight end David Martin for a touchdown and quick 7-0 lead.
Martin made that play work, outjumping safety Mark Roman to make the grab near the San Francisco 25.
The 49ers answered with a field goal drive before Davone Bess' 27-yard punt return in the second quarter set up Pennington's second touchdown.
This one was a 19-yarder to another tight end Joey Haynos. It not only was Haynos' first NFL touchdown reception but his first career catch, period.
The 49ers threatened to cut into the Dolphins lead right before halftime, but Anderson's sack of quarterback Shaun Hill pushed Frisco out of field goal range.
While San Francisco got the two field goals in the second half, the Dolphins only got inside the 49ers 40-yard line once, on its final drive, and that threat ended when Dan Carpenter's 49-yard field goal attempt bounced off the crossbar.
The Dolphins ended up being outgained by 70 yards and had the ball for only 21 minutes and change, but in the end all that mattered is that they stayed on course for a big showdown against the Jets on Dec. 28.
Of course, the Dolphins first have to take care of business at Kansas City next Sunday.