Hugill moved to the London Stadium from Preston for £9.5m in January but played only three times in the second half of last season, failing to score or assist a goal for the Hammers in just 22 minutes of Premier League football.
The manager who signed him, David Moyes, left the club at the end of last season and was replaced by Manuel Pellegrini, who has evidently decided that Hugill is not part of his plans for the coming campaign.
He will now return to the Championship, a level at which he is proven, having scored 23 goals in 100 second-tier appearances for Preston between 2015 and 2018.
West Ham prefer the loan option at this stage as Hugill's contract contains a sell-on clause which would see Preston pick up a percentage of any transfer fee received for the 26-year-old.
Middlesbrough's signing of Hugill comes as a response to the loss of Patrick Bamford, who joined Leeds last week. He is the first forward player to join Boro this summer.
Tony Pulis' team are among the Championship favourites, and they have got their season off to a good start with four points from their first two games.
Hugill was born in Middlesbrough and played for several nearby non-league teams before signing his first professional contract with Port Vale in 2013.