DETROIT (AP) Matthew Stafford has cut down on mistakes while taking advantage of opponents' miscues lately.

Stafford threw for two touchdowns, including a 1-yard pass to Calvin Johnson early in the fourth quarter, and didn't turn the ball over to help the Detroit Lions beat the San Francisco 49ers 32-17 Sunday.

The Lions (6-9) have won five of their last seven games. During that stretch, Stafford has thrown for 16 TDs and just two interceptions.

More from FoxSports

''He's taken complete control,'' Johnson said.

Stafford threw almost as many interceptions (11) as TDs (13) over the first eight games of the season. The quarterback credits offensive coordinator Jim Bob Cooter, who replaced Joe Lombardi midway through the season, for helping him have success.

''He's a smart guy,'' Stafford said. ''He's doing a good job of trying to create matchups. We're getting the ball out quick. Sometimes we're holding it.

''It's kind of tough to get a beat on us on what we're trying to do.''

Stafford was 29 of 37 for 301 yards, surpassing the 300-yard mark for the 30th time in his career. In NFL history, only Hall of Famer Dan Marino threw for 300 yards in more games (37) during his first seven years in the league.

The 49ers (4-11) have lost three straight and five of six under first-year coach Jim Tomsula.

San Francisco started relatively strong against Detroit, scoring on offense in the opening quarter for the first time and matching its season high for first-half points with 17.

Blaine Gabbert threw the ball five times to Anquan Boldin in the first quarter, and he caught each pass. He handed the ball off to DuJuan Harris nine times for 74 yards rushing in the first half. In the second half, though, Boldin wasn't targeted once and Harris had just two carries.

''I thought we were coming back out the second half and do the same thing,'' Boldin said. ''We moved the ball well the first half, the second half, I don't know.

''I don't know what happened.''

Here are some other things to know from Detroit's win over San Francisco:

DUBIOUS DISTINCTION: The Lions lined up as if they were going to go for it on a fourth-and-2 at the San Francisco 14 early in the third quarter. Detroit didn't snap the ball, hoping the 49ers would jump offside. They didn't, and that was quite a feat considering how often they did in the first half.

San Francisco became the first team to have six offside or neutral-zone penalties in the first half since 1993, when the Houston Oilers did it against New Orleans, according to STATS. The 49ers were flagged for being offside or in the neutral zone for the seventh time to set a single-game high by an NFL team this year, according to STATS, and the penalty gave Detroit a first down to extend a drive that ended with Johnson's TD catch. ''I believe I said, `Watch the ball,' about 50 to 60 times after we jumped off about five times,'' linebacker NaVorro Bowman said.

RIDDICK'S RECORD: Theo Riddick had seven receptions for 63 yards, setting a single-season record for yards receiving (668) by a Lions running back. He broke James Jones' franchise record set in 1984. If Riddick catches two passes Sunday at Chicago, he will break Jones' mark of 77 receptions in a season.

CATCH CLUB: Boldin became the 13th NFL player with 1,000 career receptions on the first play of the game. ''At this point, it doesn't mean much,'' he said. ''I'd much rather take the win.'' Boldin reached the milestone in his 185th game, a pace that trails just Marvin Harrison (167), Andre Johnson (168), Jerry Rice (181) and Larry Fitzgerald (182) in league history. Earlier this season, the former Arizona Cardinals and Baltimore Ravens receiver became the first player in league history to have at least 50 receptions and 600 yards receiving in his first 13 seasons.

MEGATRON IN MOTOWN: Johnson might have played in his last home game with the Lions. ''It wasn't on my mind,'' he insisted after making six catches for 77 yards and a TD. As Johnson's contract is structured, he will count about $24 million against Detroit's salary cap next season.

INJURY REPORT: Both teams appeared to get out of the game relatively healthy. San Francisco defensive tackle Quinton Dial left with a back strain and Lions defensive end Jason Jones went out with a stinger.

---

AP NFL website: www.pro32.ap.org and http://twitter.com/AP-NFL

---

Follow Larry Lage at http://www.twitter.com/larrylage