Boro have paid £5million to West Ham for the 30-year-old.
“I am delighted to get it all signed and completed,” Randolph told his new club’s official website.
He recently saw Joe Hart arrive at the London Stadium, meaning he was likely to play second fiddle at best for the Hammers.
“I want to come here and get the club back to where it belongs and I want to be part of something special,” he added.
He becomes Garry Monk’s sixth signing as the new manager bids to take Boro back to the Premier League after relegation.
Jonny Howson, Cyrus Christie, Martin Braithwaite, Britt Assombalonga and Connor Roberts have already made the move.