Updated

The San Francisco 49ers were in total control for three quarters of their wild-card round game against the Dallas Cowboys on Sunday afternoon.

The Cowboys made it a game in the fourth and even had one final chance with 32 seconds remaining, but the Niners survived and came away with a 23-17 victory over the Cowboys at AT&T Stadium in Arlington.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Jimmy Garoppolo #10 of the San Francisco 49ers throws a pass against the Dallas Cowboys during the third quarter in the NFC Wild Card Playoff game at AT&T Stadium on January 16, 2022 in Arlington, Texas.

Jimmy Garoppolo #10 of the San Francisco 49ers throws a pass against the Dallas Cowboys during the third quarter in the NFC Wild Card Playoff game at AT&T Stadium on January 16, 2022 in Arlington, Texas. (Richard Rodriguez/Getty Images)

Cowboys quarterback Dak Prescott ran up the middle with blockers in front of him with 14 seconds to go, but they weren't able to get the snap off from the 49ers' 24-yard line because time expired.

49ers wide receiver Deebo Samuel had 110 total yards with one rushing touchdown to lead the offense. As a team, San Francisco piled up 169 yards on the ground and managed to overcome a late interception by quarterback Jimmy Garoppolo when the team held a 13-point lead in the final quarter.

RYAN FITZPATRICK SEEN SHIRTLESS IN FREEZING COLD DURING BILLS' VICTORY OVER PATRIOTS

Elijah Mitchell #25 of the San Francisco 49ers carries the ball against the Dallas Cowboys during the second quarter in the NFC Wild Card Playoff game at AT&T Stadium on January 16, 2022 in Arlington, Texas.

Elijah Mitchell #25 of the San Francisco 49ers carries the ball against the Dallas Cowboys during the second quarter in the NFC Wild Card Playoff game at AT&T Stadium on January 16, 2022 in Arlington, Texas. (Richard Rodriguez/Getty Images)

Down two possessions, Prescott ran for a touchdown with 8:02 to go to bring the Cowboys within a score, but on their next possession, the 49ers made a big stop when Prescott threw a deep pass on fourth-down to wideout Cedrick Wilson, but it fell incomplete.

The Cowboys – easily the most-penalized team in the regular season – had 14 penalties called against them against the 49ers. San Francisco clinched its first playoff victory at the Cowboys in their postseason rivalry.

Jan 16, 2022; Arlington, Texas, USA; San Francisco 49ers fullback Kyle Juszczyk (44) is tackled by Dallas Cowboys safety Jayron Kearse (27) in the first quarter in a NFC Wild Card playoff football game at AT&T Stadium.

Jan 16, 2022; Arlington, Texas, USA; San Francisco 49ers fullback Kyle Juszczyk (44) is tackled by Dallas Cowboys safety Jayron Kearse (27) in the first quarter in a NFC Wild Card playoff football game at AT&T Stadium. (Tim Heitman-USA TODAY Sports)

CLICK HERE TO GET THE FOX NEWS APP

The 49ers lost star defensive end Nick Bosa to a concussion just before the half, but as a team, San Francisco sacked Prescott five times and held the Cowboys to 307 yards of offense. The 49ers scored on their first four possessions, but three times settled for field goals from kicker Robbie Gould to help keep the Cowboys close.

The 49ers will travel to Lambeau Field next week to take on the top-seeded Green Bay Packers in a divisional-round game.

The Associated Press contributed to this report.