The 30-year-old Scot, who raced for Force India from 2010 to 2013, will be back-up for race drivers Felipe Massa and Lance Stroll.
Deputy team principal Claire Williams said: "It's great for us to retain someone of Paul's experience."
Di Resta will combine F1 duties with racing for Mercedes in Germany's DTM touring car series.
He said he was "delighted" to stay at Williams and "looking forward to understanding the new regulations" introduced to F1 this season in an attempt to make the cars faster, more dramatic and more appealing to the audience.
Williams' new car will be revealed to the public on Friday before pre-season testing starts in Spain on 27 February.
Di Resta's best race results in F1 have been two fourth places in Singapore in 2012 and Bahrain in 2013. He was the DTM champion for Mercedes in 2010.
Part of his responsibilities at Williams will involve helping Brazilian veteran Massa, 35, support Stroll, an 18-year-old Canadian rookie who brings financial backing reported to be at least £20m to the team.
Massa retired at the end of last season but was persuaded to come back for one final year after Mercedes approached Williams to release Valtteri Bottas to them following world champion Nico Rosberg's retirement.
Paul di Resta is to stay as Williams reserve driver for a second season in 2017.