The agreement marks the second straight off-season that Gaines has signed with the Bills. He missed all of last season after suffering a core muscle injury in training camp.
The Bills originally acquired Gaines in a trade that sent wide receiver Sammy Watkins to the Los Angeles Rams in August 2017. In that season, Gaines started 11 games opposite rookie cornerback Tre'Davious White.
Gaines, 28, then signed with the Cleveland Browns in March 2018 and spent one injury-plagued season with the team before re-joining the Bills last year. He has never played in all 16 regular-season games in his NFL career.
The Rams selected Gaines in the sixth round of the 2014 NFL Draft out of Missouri. In 43 career contests between the Rams, Bills and Browns, he has recorded 198 total tackles, four interceptions and 33 passes defensed.