The 27-year-old only joined the Black Cats in January in a £5million deal from Swansea but failed to score in 13 appearances.
Graham's signing is a boost for Tigers boss Steve Bruce, who saw a move for Burnley's Charlie Austin fall through this summer.
He is Hull's seventh close-season signing following the recruitment of keepers Allan McGregor and Steve Harper, defenders Curtis Davies and Maynor Figueroa and midfielders Ahmed Elmohamady and George Boyd, the latter having made his loan switch from Peterborough permanent.
Graham scored 12 goals for Swansea during their first campaign in the top flight in 2011/12 and added a further three goals in 2012/13 before his move to the Stadium of Light.
Graham has also previously played for Middlesbrough, Carlisle and Watford and enjoyed loan spells at Darlington, Derby, Leeds and Blackpool.
Graham told the Tigers' official website: "It's great to come to a club where everybody is on a high after winning promotion and I've only heard good things about this club.
"It's exactly the same as when I joined Swansea a couple of years ago, a club coming up into the Premier League. The stories for two clubs are very similar.
"I know I'm coming to a good club with a top manager, a fantastic stadium and some very good players."