Gilbert finished 14-of-28 through the air for 212 yards with two interceptions and carried the ball 18 times for 98 yards for the Mustangs (7-6), who scored 22 points in the second quarter to secure the victory.
Austin Fuller made four grabs for 84 yards and Der'rikk Thompson contributed five catches en route to 82 receiving yards for the victors, who took advantage of four Fresno State turnovers.
Zach Line picked up 71 rushing yards on 19 carries in the win.
Derek Carr threw for 362 yards on 33-of-54 efficiency with a TD and two pick-offs for the Bulldogs (9-4).
Davante Adams made 13 grabs for 144 yards with a score in the loss.