Flamini, whose contract expired at the end of June, had announced his departure as contract talks stalled following a knee injury that ruled him out for most of last season.
But the Frenchman, 28, has elected to stay at the San Siro, with reports claiming he took a pay cut to remain a Rossoneri.
"Our relationship with Flamini continues," the club website announced. "We had meetings in France with Mathieu, who had been interesting other major clubs in Europe.
"We shook hands on a deal and now it is confirmed."
Flamini joined Milan on a free transfer from Arsenal in 2008, and has played 100 matches for the club, scoring four goals.
The club hinted that the former Marseille midfielder had agreed to a lower wage, adding that "the terms are different from the past four years".
Ghana international Adiyiah, 22, has joined Ukrainian side Arsenal Kiev for an undisclosed fee.
He has signed a three-year contract, having spent part of last season on-loan at the club.
Milan are on a rebuilding mission after losing their Serie A title to Juventus, with veteran midfielders Gennaro Gattuso and Clarence Seedorf also leaving the club while the on-loan Alberto Aquilani returned to Liverpool.
They have also signed midfield trio Riccardo Montolivo, Kevin Constant and Bakaye Traore.
