PROVO, Utah (Ticker) -- Matt Berry threw three touchdown passes, including a four-yarder to Gabriel Reid with 3:28 remaining, as Brigham Young rallied for a 35-31 Mountain West Conference victory over Wyoming.
Berry completed 31-of-45 passes for 360 yards for the Cougars (5-5, 2-3), who posted their second straight victory following a three-game losing streak.
BYU needs to split its last two games to avoid its first non-winning season since 1973, LaVell Edwards' second year at the Cougars' helm.
BYU, which had 532 yards of total offense, prevailed despite squandering a 28-17 second-half lead.
Safety Jacque Finn returned an interception a school-record 100 yards, pulling Wyoming within 28-23 as the third quarter expired. The two-point conversion attempt failed, but the Cowboys (2-8, 1-4) took a 31-28 lead on Derek Armah's three-yard TD run with nine minutes to play.
BYU opened a 21-14 halftime lead on Lane Pendleton's three-yard TD scamper with 3:27 before intermission.
After Wyoming's Scott Parker kicked a 21-yard field goal early in the third, BYU stretched its lead to 28-17 on Berry's 21-yard TD pass to Andrew Ord.
Marcus Whalen paced the Cougars on the ground with 124 yards and a touchdown on 26 carries.
Casey Bramlet completed 21-of-36 passes for 283 yards for Wyoming, which has dropped two straight after snapping a 17-game conference slide. The Cowboys were coming off a 49-48 overtime setback to Nevada-Las Vegas.