The third-year defensive back was entering the final year of his contract. Terms of the deal were not disclosed.
Robey signed with the Bills as an undrafted free agent in April 2013. He has not missed a game for Buffalo.
In 32 games and eight starts, Robey has four sacks and an interception, also making 84 tackles and defending 18 passes.
He has played primarily as a nickel back, and Buffalo drafted corner Ronald Darby with its first pick, 50th overall.
Buffalo signed Williams as an undrafted free agent out of Bethune-Cookman on May 4, but released him on Thursday. He is the son of former San Diego and Houston defensive lineman Lee Williams.
AP NFL websites: http://www.pro32.ap.org and http://www.twitter.com/AP-NFL