The 29-year-old, who spent four years with Arsenal before his 2008 departure, began training with his former club earlier this summer when his Milan contract expired.
And Arsene Wenger has been impressed enough to make Flamini his second close-season signing.
"We're very pleased Mathieu has agreed to rejoin us," Wenger told the club website. "He is a player of real quality, with a fantastic work rate and great mentality.
"As we know, Mathieu is a strong midfielder, but is also comfortable playing in defence too. He is a very good addition to our squad.
"He is a bit older, but he is still only 29. The best years are in front of him now - the next three years. Physically, he is perfect. He was tested, prepared and he is physically in fantastic shape.
"He knows how we play football, knows the club and had a huge desire to come back. He was available because he was out of contract and he is a quality player, and a focused player. Those were all the reasons that pushed me to make that decision."
Flamini will come into contention for Sunday's north London derby and he said: "Everyone knows how important it is. We have to win it and we have to be ready for it.
"It feels good to be back home. I have some unfinished business with Arsenal so it's a great feeling to be back. Once you're a Gunner, you're always a Gunner.
"Unfinished business because we had the opportunity a few times when I was there to win trophies and we didn't. I'm thinking about the Champions League final (in 2006), the 2007/08 season when we were in the running for first place and we didn't close it."
Flamini's arrival follows that of his fellow Frenchman Yaya Sanogo, also on a free transfer.
Wenger is still to spend a penny in fees on new faces despite the "escalation in financial firepower" reported by chief executive Ivan Gazidis back in June.