We generally go to Williamsburg in August - yes, it can be hot there but it is hot at home too. We have gone in June and before schools start summer vacation there will be less crowds but you may encounter school groups. The last weekend in June has traditionally been a big reenactor event in Colonial Williamsburg and that brings in big crowds. They have cancelled it in the past two years - first for a conflicting event and then no one knows why this past year. If they bring it back and there are a lot of requests to bring it back (called "Under the Redcoat" and it is something to be experienced) it will be that last weekend in June and it will be crowded that weekend.
Williamsburg will be in full swing in June - don't worry about the heat - just enjoy!