At times, Tommy Rees and the offense looked unstoppable and the defense forced quick stops. Other times, both were wildly erratic and inconsistent.

Just like Notre Dame's season.

Rees threw two interceptions late in the fourth quarter, and No. 25 Notre Dame lost 27-20 at No. 8 Stanford on Saturday night in the regular-season finale for both teams.

A year after losing to Alabama in the BCS championship game, the Fighting Irish (8-4) now have to wait to find out whether they land a lower-tier bowl invitation.

"Not good enough obviously. Proud of the guys and my teammates and how we fought all year but you don't come to Notre Dame to go 8-4, and everyone understands that," Rees said. "You have to be better."

Along with injuries to both lines, the back end of Notre Dame' defense also played shorthanded. Safeties Elijah Shumate and Eilar Hardy did not travel to Stanford due to a violation of team rules.

The Cardinal still had to overcome two interceptions from Kevin Hogan and a penalty that wiped away another touchdown to win their 16th consecutive home game. Tyler Gaffney ran for 189 yards and a touchdown to cap his sensational Senior Day, and Hogan threw for 158 yards and TD pass to Devon Cajuste to help the Cardinal take a 21-6 lead in the third quarter.

"We took it to them and we were fortunate to come out on top," Gaffney said.

Stanford will go for its second straight Pac-12 title trophy and Rose Bowl berth when it faces No. 13 Arizona State next. At the very least, the Irish made the Cardinal's final tuneup for that game another tough test.

Rees nearly rallied the Irish by throwing two touchdown passes later in the quarter. But Wayne Lyons intercepted a pass by Rees on each of Notre Dame's final two drives to dash the comeback.

"We had a chance to win the game. Our offense kept us in it. God, we just needed to make another play," Irish coach Brian Kelly said.

Notre Dame drove deep in Cardinal territory on its first and final drives of the first half before settling for field goals each time. With Stanford seemingly ready to turn the game into a rout, Rees threw touchdown passes to TJ Jones and DaVaris Daniels late in the third quarter before missing his targets late.

Rees finished 16-for-34 passing for 199 yards. He passed Jimmy Clausen (60) for second on Notre Dame's career list with 61 touchdown passes, behind only Brady Quinn (95).

Stanford had no problem sustaining drives but struggled to finish them with touchdowns in the second half, twice settling for field goals. On one of them, a holding penalty on right guard Kevin Danser — only the second one by a Stanford offensive lineman all season — erased a touchdown rushing for Gaffney.

Bennett Jackson and Austin Collinsworth each intercepted a pass by Hogan, and officials also called a 15-yard personal foul penalty on Alex Carter — originally ruled targeted before it was overturned on a video review — that led to a Notre Dame touchdown.

Just as it has so many times over the past two seasons, the Cardinal defense still bailed out the offense in the end.

Lyons intercepted an underthrown pass by Rees, the 36th straight game the Cardinal have forced a turnover. And after the Irish stopped Stanford three-and-out, Lyons leaped high to intercept another pass by Rees on Stanford's 30 with 2:24 left.

"We had worked on trying to get the ball into the seam, got into a collision and obviously the interception," Kelly said. "Again, couldn't make the play when we needed to."