The striker has signed a five-year deal at Vicarage Road.
Gray scored nine Premier League goals last season as Burnley successfully avoided relegation.
The Clarets did not wat to let the former Luton man go but with just 11 months left on his contract they were left with the option of cashing in now or losing the player for nothing next summer and they chose the former.
The pacey striker is a non-league success story having made the step up to league football after spells at Hinckley Town and Luton Town earlier in his career.
The fee is believed to be in the region of £18.5m.