He has made 155 appearances for the Lions since signing from MK Dons for an undisclosed fee in January 2014.
The 30-year-old played 56 games in all competitions last season.
"Having such success last season made it an easy decision for me to sign another contract," Williams told the club website.

Finance Secretary John Swinney has vowed not to increase taxes for low paid workers.
His draft budget is being debated for the first time at Holyrood.
Both Labour and the Lib Dems have called on him to increase income tax in Scotland to 1p above the UK rate.
The budget for 2016-17 marks the first time Holyrood ministers have been required to play a part in determining income tax rates in Scotland.
The two opposition parties said a rise was necessary to provide almost £500m of additional funding for education and other services.
With the Scottish rate of income tax due to come into effect from 6 April, Deputy First Minister Mr Swinney has pledged to keep payments in line with the rest of the UK.
In addition, he said his draft budget would give up to 51,400 low paid workers a pay rise, by uprating the living wage and extending this to social care workers as part of the local government settlement.
Speaking ahead of the budget debate, Mr Swinney said: "I will not penalise those on low incomes, and I certainly won't increase their tax bill.
"Our budget will see an additional £250m invested in social care, around £13bn for health, it will freeze council tax for a ninth consecutive year, protect police budgets, invest £690m in housing, allocate over £1bn for higher education, and protect the pupil-teacher ratio, helping improve attainment."
Scottish Labour leader Kezia Dugdale has tabled an amendment to the budget, calling for the Scottish rate of income tax to be set at 11p, a penny more than the rate proposed by the SNP administration.
Labour argues this cash would help avoid cuts to schools and other vital local public services, with Ms Dugdale insisting the new tax raising powers must "not lie unused on the shelf".
She has written to First Minister Nicola Sturgeon saying she is willing to work together on the issue.
Labour's plans for a 1p rise in income tax were unveiled days after the Scottish Liberal Democrats proposed increasing the levy to help fund education.
The party's leader Willie Rennie said: "As it stands, this SNP budget will deliver the harshest cuts to education in a decade and responsibility for those will lie squarely on the shoulders of John Swinney and his SNP colleagues.
"John Swinney has spent all of his political life calling for increased powers for the Scottish Parliament. Well now he has them. Now he could use them. But instead he's decided to undercut George Osborne on tax."
The Scottish Conservatives have said they would resist an increase in taxes in Scotland.
The Scottish Greens said Labour's plan was "complex and costly".
Read more here
Millwall midfielder Shaun Williams has signed a 12-month contract extension with the newly-promoted Championship club, with an option for an extra year.
[NEXT_CONCEPT]
MSPs will take part in a showdown vote later on income tax as opposition leaders challenge the Scottish government to raise extra money to protect public services.