Olaniyi was 7-for-15 shooting but made all seven free throws for the Seawolves (15-8, 6-2 America East) while Foreman was 6-for-18 shooting with three 3-pointers. Andrew Garcia added 12 points for Stony Brook.
Stony Brook led 30-25 at halftime and a 7-0 run sparked a second-half surge that pushed the lead to as many as 16. UMBC cut that to nine three times in the last 3:51, but Olaniyi pushed it back to 11 a final time with free throws at 54 seconds.
Stony Brook returns to action Wednesday against UMass Lowell. UMBC hosts Hartford on Wednesday.
More AP college basketball: https://apnews.com/Collegebasketball and https://twitter.com/AP-Top25
Growing up Kobe: What it's like for these college basketball players to share a legendary name
Kobe Bryant's emergence in the '90s popularized what had been a unique first name. These college players talk about the experience of sharing the name -- especially since Bryant's death.
Utah State seeks revenge on UNLV
Utah State (12-5, 9-2) vs. UNLV (6-6, 3-2)
ETSU looks to extend streak vs Chattanooga
Chattanooga (12-5, 3-5) vs. East Tennessee State (9-5, 5-1)