The 23-year-old returns to the Riverside Stadium, where he spent the 2014-15 season on loan from the Blues.
He began this season on loan at Burnley but was recalled by Chelsea on Saturday, having made six Premier League appearances without scoring.
It was his sixth loan spell away from Stamford Bridge.
The deal includes a number of clauses which could see the striker's fee rise.
The clauses are dependant on whether Middlesbrough survive in the Premier League this season, Bamford making a certain number of appearances and scoring a certain number of goals.
In his previous stint with Boro, Bamford finished as the club's top scorer with 19 goals and was named Championship Player of the Year.
Middlesbrough made the play-off final that season but were beaten by Norwich.
The former England Under-21 international is Boro's second January signing following the purchase of Rudy Gestede from Aston Villa.
This site is optimised for modern web browsers, and does not fully support your browser
Middlesbrough have signed Chelsea forward Patrick Bamford for about £5.5m on a four-and-a-half-year deal.