The 41-year-old actor-maker and his childhood friend Matt Damon co-wrote the script for the 1997 drama, in which they also starred.
"Heartbroken. Thanks chief - for your friendship and for what you gave the world. Robin had a ton of love in him. He personally did so much for so many people. He made Matt and my dreams come true.
"What do you owe a guy who does that? Everything. May you find peace my friend," Affleck wrote on his Facebook page.
'Good Will Hunting' won critical acclaim, landing nine Academy Award nominations and earning them the Best Original Screenplay Oscar, while Williams walked off with the Best Supporting Actor title.
Robin Williams died of an apparent suicide on August 11.