The controversial striker travelled to the Italian city on Wednesday and completed formalities on Thursday morning.
It brings to an end a colourful, headline-filled two-and-a-half year spell in England.
Milan also confirmed Balotelli had signed a four-and-a-half year contract and would be presented to the press as a Rossoneri player on Friday evening.
A statement from the Serie A club read: "AC Milan announces that it has acquired from Manchester City Mario Balotelli, who has signed a contract until 30 June 2017."
City and Milan are reported to have agreed a fee of around £19million, rising to £22million for the player.
Balotelli helped City win the FA Cup in 2011 and the Premier League title last year and admitted he would miss the club.
He told City's website, www.mcfc.co.uk: "For sure I will remember my brilliant team-mates, the manager and all the supporters.
"They are the best, they were great with me and I will always have a very special place in my heart for City, it's a great club with a great future.
"I thank them for all of their support of me. Maybe one day we will see each other again."
Balotelli had been linked with Milan throughout the month but City continually played down the prospect of him leaving.
But with senior figures at Milan continuing to discuss the possibility of deal, rumours of his departure continued.
They intensified earlier this week and the move was all but confirmed by both clubs on Tuesday as Balotelli missed City's Premier League game at QPR.
Balotelli also paid tribute to City boss Roberto Mancini, who afforded the often wayward striker considerable latitude during his time at the club.
Balotelli said: "Yes, I said goodbye to everyone at the meal in London before the game at QPR. It was a very emotional for me.
"I spoke with Roberto before I went to speak to the players.
"We spoke for some time about lots of things. He was sad, and I was too.
"But it was a good conversation. I love Roberto, he has been very important for my career, and I will always thank him for having trust and faith in me.
"Being at City was an important part of my life and career. I needed to grow up like a player and as a person and it has been a very good experience for me."
The fee means City are just short of recouping the £24million they paid Milan's arch-rivals Inter for Balotelli in 2010.
He scored 30 goals in 80 appearances and his contribution City's success was not insignificant, but he will be equally well remembered for four red cards, clashes with team-mates, brushes with discipline and other misdemeanours.
He never regained a starting place after a dismal performance in the derby defeat by Manchester United on December through a combination of illness and selection issues.
After the United game it emerged he has planning to take the club to a Premier League tribunal in a dispute over a club fine, although he later dropped the challenge.
He then became involved in a training-ground bust-up with Mancini earlier this month.
It proved the last of a long line of controversies as, although Mancini promised to give Balotelli "another 100 chances", Milan's interest ultimately proved tempting for all parties.
Balotelli said: "I will always be interested in Manchester City and their fortunes.
"I really hope that City can win the league again this year and beat United.
"I think there are great players at the club and a great manager too. The club will be very successful in the future and that makes me happy."
Balotelli's arrival in Milan prompted chaotic scenes.
He was swamped by reporters, photographers and fans as he arrived a clinic for his medical and there have been reports of police dispersing unruly crowds outside a restaurant where he met club officials.