The playoffs are out of reach in the Motor City, but the Detroit Lions are playing like they are still in the hunt. 

The Lions (6-9) hosted the San Francisco 49ers and pulled away in the second half to win 32-17 on Sunday afternoon. Matthew Stafford led the team to victory with 301 yards and two touchdowns through the air for Detroit.

While the Lions got the win, the 49ers (4-11) got on the board first early in the first quarter. Blaine Gabbert connected with Vance McDonald for a one-yard touchdown giving San Francisco a 7-0 lead.

Just about four minutes later Matt Prater tacked on a 36-yard field goal for Detroit to cut their deficit to four points. T.J. Jones ran a deep route and Stafford had no problem completing the pass. The receiver took to the end zone for a 29-yard touchdown and a three point lead for the Lions as the second quarter started to roll around. 

It was the first career touchdown for Jones, who was the sixth round of the 2014 NFL Draft out of Notre Dame. Over eight games with the Lions prior to the game against the 49ers, the 23-year-old posted 103 receiving yards on nine receptions with Detroit. 

The 49ers bounced back with Gabbert once again. The quarterback, who started the season as the backup to Colin Kaepernick, delivered a 16-yard strike to Torrey Smith to retake the lead with 11:30 to play in the first half.

Gabbert finished 22-of-33 through the air for 225 yards and touchdown. He was sacked three times for 24 yards in the outing. The 26-year-old lost one fumble, which was really his only blemish of the afternoon. McDonald led all receivers with 61 yards and a touchdown, while Bruce Ellington chipped in 55 yards. 

With a 14-10 lead, Gabbert was sacked by Josh Bynes and Haloti Ngata for a nine-yard loss. On the play, the quarterback fumbled and the ball was recovered by Tahir Whitehead at the one-yard line of the 49ers. On the next play, Joique Bell carried the ball to the house for a 17-14 lead in favor of the Lions. 

As for the run game, Ameer Abdullah, a rookie, struggled on the day. He ran the ball eight times for 39 yards, while Bell scrambled for 13 yards and a touchdown. Theo Riddick chipped in 20 yards on the ground. For San Francisco, DuJuan Harris carried the ball 11 times for a game-high 73 yards. 

Phil Dawson, the kicker of the 49ers, missed a 45-yard field goal that would have tied the game up. The kick went wide left and Detroit took over. on their own 35-yard line with 5:42 left before halftime. 

After missing a field goal, Dawson bounced back with under a minute to play with a 40-yard field goal to tie the game at 17 each. 

With 20 seconds left Stafford passed to Golden Tate for a 36-yard gain to the 25-yard line of San Francisco. The quarterback got to the line and spiked the ball, which gave Prater two seconds to hit a field goal. The kick from 38 yards out was good and the Lions headed to the halftime locker room with a 20-17 lead. 

A drive of 11 plays, 64 yards and 6:35 minutes ended in a kick down the middle for a 37-yard field goal and three points by Prater to give the Lions a 23-17 lead over the 49ers. The play was made possible by an 18-yard connection between Stafford and Calvin Johnson to push the Lions into San Francisco territory. Earlier in the week, Johnson made the 2016 Pro Bowl

On consecutive plays, Devin Taylor dropped the San Francisco running back for a loss of two yards, then he sacked Gabbert for a loss of 12 yards to force a 3rd and 24, which resulted in a punt for the 49ers. The Lions took over at their own 36 with just over a minute to play in the third quarter. 

Johnson continued his above par afternoon with a one-yard score with 9:07 to play in the game. The catch in the end zone gave the Lions a 29-12 lead. It was Johnson's eighth touchdown of the season. 

"Megatron" could have played in his final home game with the Lions. The veteran is slated to count $24 million against the cap next year and might move on to a different team. Stafford is looking toward the future and Johnson, 30, probably would not be in the picture much longer for Detroit. 

Stafford went 29-for-37 with 301 yards and two touchdowns in the Detroit victory. He connected with Johnson six times for 77 yards and a score. Meanwhile, he dished out seven passes for 63 yards to Riddick out of the backfield. Tate chipped in 59 yards as a receiver. 

On the next offensive drive for the Lions, Johnson caught a 22-yard pass to the one-yard line of the 49ers, but the play was reversed and called incomplete. The offense could not pick up a first down and Prater was forced to kick a field goal. The 31-year-old pushed the Lions lead to 32-17 on a 34-yard field goal with three dollars, a dime and a penny to play in the game. Prater finished 4-for-4 on field goals and 2-for-2 on extra points, which gave him 14 points. 

Gabbert's pass to McDonald was incomplete on 4th and 3 to give the Lions the ball back. Stafford and the offense went into victory formation to give Detroit a 32-17 lead.