The Cardinal scored two runs in the eighth to close to within a run and had runners on the corners with no outs.
Kavin Keyes, however, started a double play that first recorded an out at second. Andy Peterson, the OSU second baseman, then threw to catcher Nate Esposito, who made the tag on Austin Wilson and held on to the ball as the runner attempted to jar it loose.
Scott Schultz, on to close, then got Alex Blandino swinging to end the inning. Schultz went on to a perfect ninth for his 10th save of the season.
Oregon State managed just three hits in the win but took advantage of nine walks, four hit batsmen and five Stanford wild pitches.
Ben Wetzler scattered five hits and two runs in 6 1/3 innings and Danny Hayes hit his fourth home run of the season.
Hayes hit a two-run home run in the second. It came after Dylan Davis walked to open the inning. The home run opened the Beavers' scoring and sent Oregon State to its 12th consecutive victory -- tied for the longest active streak in the nation.
The Beavers improved to 41-8 on the year with the win and are 20-4 in Pac-12 Conference play. Stanford, meanwhile, is 26-20 overall and 11-13 in conference games.
Wetzler won his sixth straight game to improve to 6-1 on the year. The lefty threw 88 pitches and struck out five with one walk. The outing was Wetzler's sixth consecutive quality start and 18th in-a-row for Oregon State in Pac-12 play.
The Beavers tacked on insurance runs in the fourth and fifth innings. Hayes scored on a wild pitch in the fourth, then drove in the first run of the fifth when getting hit by a pitch with the bases loaded. Kavin Keyes drove in the inning's second run with a short sacrifice fly to left.
Those insurance runs came in handy as Stanford pulled to within three with a two-run sixth inning. Brian Ragira drove in the first run on a fielder's choice and reached second on a throwing error. He was the driven in by a single off the bat of Austin Wilson.
Stanford's Sam Lindquist made his first career start and lasted four innings, throwing 79 pitches in the process. He allowed just two hits but gave up five runs to take the loss. He dropped to 2-2 on the year.
Oregon State next visits Oregon for the Civil War. The first game of the series is Friday night at 6 p.m. PT. The game can be followed via live video, audio and stats, with all the links available on osubeavers.com.
It's another sweep: OSU hangs on at Stanford
BeaverBlitz Top Stories
Boise Reaction: Devin ChappellDevin Chappell speaks to the media following the Beavers loss to Boise.
BeaverBlitzYesterday at 9:10 PM
Victor Bolden post-gameSenior wide receiver Victor Bolden meets the press.
BeaverBlitzYesterday at 8:57 PM
Reaction: Nall + BlountSophomore running back Ryan Nall and freshman quarterback Conor Blount meet the press following the Boise State loss.
BeaverBlitzYesterday at 8:37 PM
Reaction: Gary AndersenHead coach Gary Andersen met with the media immediately following the Beavers 38-24 loss to Boise State.
BeaverBlitzYesterday at 8:21 PM