BUFFALO, N.Y. (AP) - James Gilbert ran for 264 yards and two touchdowns, including a tie-breaking 80-yarder, to lead Ball State to a 31-21 win over Buffalo on Saturday.

Gilbert carried the ball 34 times on his way to the second-best day in Cardinals' history, just behind the 301 yards of MiQuale Lewis in 2009.

Late in the third quarter, Gilbert went off tackle and found a seam to the right sideline for a score that made it 21-14. The sophomore had scored on the opening drive for the Cardinals (4-3, 1-2 Mid-American) but Tyree Jackson had a pair of touchdown passes that gave the Bulls (1-5, 0-2) a 14-7 lead at the half.

Ball State quarterback Riley Neal tied the game midway through the third with a 9-yard run and he added another score on a 7-yard run early in the fourth quarter.

Jackson was 28 of 46 for 306 yards, all career-highs, and added a third TD pass in the fourth quarter.

Ball State finished with 568 yards, 356 on the ground, and Buffalo had 459 yards.