Championship side Boro announced they have agreed a deal in principle with the Hammers to sign the Republic of Ireland international.
Randolph lost his place in the West Ham team towards the end of last season and the east London club have since signed England number one Joe Hart.
Middlesbrough say the 30-year-old former Charlton, Motherwell and Birmingham keeper will travel to their Rockliffe Park base on Saturday to undergo a medical and finalise the move.
Randolph will become the sixth new face to be added to new boss Garry Monk's squad this summer after Jonny Howson, Cyrus Christie, Martin Braithwaite, Connor Roberts and Britt Assombalonga.