I think he said in an interview once that he grew up in San Francisco surrounded by gay/lesbians through his formative years and that because of such, he has no problem playing gay characters or associating himself with gay people/organizations.
Or something to that effect. But as for Robin Williams himself no, he is not gay. Are you?