The Cornhuskers (11-10, 2-6 Big Ten) won for the first time in four conference home games.
Brandon Ubel had 14 points and 12 rebounds, and Gallegos added 11 points.
Ubel made two free throws and converted Gallegos' pass through the lane into a dunk at the front end of a 16-7 spurt that gave Nebraska a double-digit lead in the middle of the second half. Gallegos followed Shavon Shields' three-point play with three straight 3s to make it 44-33.
adidas Men's Nebraska Cornhuskers Scarlet Long Sleeve Shooter ShirtPrice: $47.97 Shop
NC State lands guard Markell Johnson, who has reclassified into the class of 2016 after being ranked No. 48 in the ESPN 100 in the class of 2017.
Pirates catcher Jacob Stallings, the son of University of Pittsburgh basketball coach Kevin Stallings, made his major league debut on Sunday night.
Iowa State lands transfer Ray Kasongo from Tennessee.