The 41-year-old actor, known as Danny Castellano on the hit romantic series, will play Affleck's best friend and partner in crime in the film, reported Variety.
The film is directed by Affleck and will reunite Messina who previously worked with the "Gone Girl" star in the 2012 political thriller "Argo".
The prohibition-set drama, based on the Dennis Lehane novel, will tell the story of a Boston police captain's son (Affleck) who rises through the ranks of the criminal underworld.
"Live By Night" is scheduled to release in 2017.