Boro were in the market for an established goalkeeper following the return of Marcus Bettinelli to Fulham following a mixed season-long loan at the club.
Jordan Archer who joined the club in January on a short-term deal until the end of 2020-21, ended the campaign between the posts, but is now out of contract.
Lumley, who made six appearances for the R's in 20-21, underwent a medical at Boro on Wednesday and becomes the club's first capture of the close season.
The 26-year-old was largely second choice to Seny Dieng, but featured in two emergency loan spells at Doncaster Rovers and Gillingham.
A virtual ever-present for QPR between 2018 and 2020, Lumley impressed in his time at Rovers, where saw him make nine appearances late last year. Prior to joining up with Boro, the Harlow-born custodian was linked with Millwall.
Boro manager Niel Warnock said: "I'm delighted to have signed Joe. I've always rated him highly and I look forward to him joining us.
"I know he's excited about coming here and he can't wait to play in front of the Riverside crowd."
Lumley joins on a two-year contract with the option of a further year.
Boosting the club's strikeforce is viewed as the club's overwhelming priority this summer and Boro have been linked with a number of targets, including Rotherham United forward Michael Smith.
One target, in the shape of Luton Town's James Colins, is reportedly set to join Cardiff.