The win enabled the Beavers (21-7 overall, 11-5 in Pac-10 play) to remain one game behind first-place USC.
The Beavers were led by Steve Woodside with 14 points.
The Bears (12-14, 4-12) were led by guard Kevin Johnson, who scored a game-high 19 points.
Cal's deliberate style of play gave the Bears a 22-20 lead at halftime, and they still held a 28-26 advantage with 15:37 left to play.
But Oregon State, led by Woodside and Tyrone Miller, who started the second half and had nine points, outscored Cal, 13-3, to take a 39-31 lead with 2:31 to go.
Oregon State star A.C. Green, who was playing his last home game, scored 13 points. Tyrone Miller added nine, all in the second half.
The win was Beaver Coach Ralph Miller's 600th career victory. Official NCAA statistics, however, will show Miller's total at 585 because of 15 forfeits given up by the Beavers when Lonnie Shelton signed a professional contract, then was allowed to play due to a court order in the 1974-75 season.
Oregon made its first four shots, took a 10-2 lead and never trailed, although Stanford made it close in the second half by moving to within 41-36 after the Ducks had led, 37-20.
Oregon (8-8, 15-14) made 22 of 26 second-half free throws, including 12 in a row, to hold off the Cardinal (3-13, 11-15).
John Williams led the Cardinal with a career-high 10 points.
Arizona State, which trailed by as many as 14 points early in the second half, closed to within three points, 70-67, with 3:20 to play. But the Cougars, who scored 14 of their final 16 points from the free-throw line, pulled away.
Washington State (12-14, 4-12) moved out of the Pac-10 cellar. The Sun Devils (12-15, 7-10) were led by Ron Singleton with 14 points.