Boateng was in possession on the left wing in the 26th minute when he responded to the abuse by suddenly picking the ball up and kicking it towards the stand behind him.
The Ghana midfielder then tore off his shirt and walked off the pitch, followed by the rest of the Milan side.
Boateng said on Twitter after the game: "Shame that these things still happen... #StopRacismforever".
His team-mate Nigel de Jong tweeted: "Great action today of my teammates backing @KPBofficial (Boateng) 2 walk off the pitch. Federation got 2 stand up! #StopRacism."
Manchester City defender Kompany added: "I can only salute Milan's decision to leave the pitch. Also noted that the majority of the fans were completely supportive of the players."
Rio Ferdinand said: "If the stories about KPB walking off the pitch with teammate's after being racially abused are true,fair play to him..well done #UefaStandUp".
Milan's website said there was also racist abuse by "a minority of Pro Patria fans" at Mbaye Niang, Urby Emanuelson and Sulley Muntari.
Italian Football Association president Giancarlo Abete announced an immediate inquiry, branding the incident "unspeakable and intolerable" and an offence to Italian football.