"We're excited to go to Madison Square Garden," Len said. "It was just a huge win for our program."
Alabama cut a 10-point second-half deficit down to 48-47 when Cooper got a layup off a nice pass from Lacey.
The Terrapins answered with a 3-pointer by Pe'Shon Howard — his first points of the game — and two more by Layman, who celebrated the second with a little dance and a yell as he came back up the court with Maryland's lead back to 57-49 and 3:40 remaining.
Cooper and Nick Jacobs both converted three-point plays and Wells was called for traveling on two straight possessions after Len made 1 of 2 from the foul line.
Releford drove to the basket with 47 seconds left, cutting it to 58-57.
Nick Faust nearly lost the ball against the full-court press but managed to drive to the basket. He missed the shot but Len grabbed the rebound and drew the foul.
He missed both free throws with 27 seconds left and Randolph rebounded the second and crossed midcourt before Alabama called timeout.
Randolph inbounded to Lacey, who managed to get off the final attempt.
"I feel like Trevor got a good look," Randolph said. "We drew up an inbounds play and he came up. He got a good shot up."