CORVALLIS, Ore. (AP) Kevin Hogan, a game-time decision because of an ankle sprain, threw for 163 yards and two touchdowns as No. 21 Stanford beat Oregon State 42-24 on Friday night.

Christian McCaffrey ran for a career-high 206 yards for Stanford (3-1, 2-0 Pac-12), which held just a 21-17 lead at the half over the Beavers (2-2, 0-1) before a pair of third-quarter touchdowns.

Oregon State true freshman Seth Collins hit Jordan Villamin with a 40-yard scoring pass to open the fourth quarter and the Beavers pulled within 35-24, but Stanford answered with Barry Sanders' 65-yard touchdown run and Oregon State couldn't catch up.

More from FoxSports

Collins passed for 275 yards and a touchdown, while rushing for another score. Villamin caught seven passes for 138 yards.

Sanders rushed for 97 yards and two scores for the Cardinal.

Hogan was a question mark for the game after injuring his left ankle in the second half of last week's upset of then-No. 6 USC. He threw for 279 yards and two touchdowns in that one, gritting out a 41-31 win that put Stanford back in the rankings.

He showed no sign of the injury against the Beavers, deftly moving the Cardinal downfield on the opening series of the game. Remound Wright capped the drive with a 1-yard scoring run.

Collins answered for the Beavers with a 1-yard touchdown run after finding Victor Bolden in traffic with a 7-yard pass to get close.

After Hogan hit Austin Hooper with a 42-yard TD pass to make it 14-7, Collins again led Oregon State on a successful drive that ended with redshirt freshman Ryan Nall's 5-yard scoring run, the first touchdown of his career.

Stanford went up 21-14 in the second quarter on Wright's 2-yard scoring run. But Cardinal starting defensive end Aziz Shittu was injured before the half and had to be helped from the field.

Garrett Owens made a 24-yard field goal for Oregon State just before halftime that cut the margin to 21-17.

Collins fumbled on the opening series of the second half and Stanford recovered on the Oregon State 9-yard line, but the Beavers' defense held and the Cardinal had to settle for a 28-yard field goal attempt- which missed wide left.

Stanford began to pull away midway through the third quarter when Hogan hit Michael Rector with a 49-yard touchdown pass that extended the lead to 28-17. Sanders added an 11-yard scoring run for the Cardinal later in the quarter.

Senior linebacker Kevin Anderson, Stanford's second-leading tackler, did not play because of an undisclosed injury. Teammates wrote his number on arm and elbow wraps.

Linebacker Joey Alfieri made his first career start against the Beavers. His dad, Phil, played defensive end at Oregon State from 1983-88.

The Beavers, in their first year under coach Gary Andersen, were coming off a 35-21 victory over San Jose State last weekend.

It was Stanford's sixth straight victory over Oregon State.

---

AP college football website: -www.collegefootball.ap.org