First family vacation in a while. Planning on two weeks around Yosemite middle of August with wife and son ...
If you are staying just outside of YNP then plot all these suggestions on a map. Then use Google Directions to plot driving time to each of them. It's a big state, as big as Boston to Atlanta. You don't want to spend days crawling in tourist traffic.
I'll emphasize in this post things that are local to where you are staying, Yosemite, NorCal, and the Nevada border region just east of it.
Yosemite is a must-see. Half Dome in that photo above, is a VERTICAL MILE from the campground below. Crowds are inevitable in August but it's still worth it. Maybe the hordes of hot, fit young women there will make the crowds there more bearable for your son.
Another must-see within a day's drive is over Tioga Pass to Mono Lake and the NP visitor center there. Then to Bodie, NE of there. It's a ghost gold mining town, abandoned 80 years ago with the buildings preserved as a State Park. It's never very crowded.
Here are photos looking down toward Mono Lake, then East into YNP, from a solo
offroad adventure in 1999. The view looking down from Tioga Pass is similar.
Then return over the Sierras to your lodging over one of the passes described above.
Virginia City in Nevada, East of Carson City, is also interesting but a little too far to include in the same day trip. Maybe a trip the next day. Site of huge underground silver mines (the original basis for Nevada's economy) with miles of shafts and tunnels, now a cute but still interesting tourist site. Not too crowded.
There are Redwood groves just south of Yosemite so this might be preferable to the two-day trip to see the (more extensive) north coast redwoods. The redwood grove at Muir Woods just north of San Francisco is also an alternative.
San Francisco is vastly different from what you see on TV. Downtown and the tourist areas - Chinatown, Fisherman's Wharf, etc are magnets for crazies who prey on tourists. The universal -and real- advice is thieves will break into every parked car hoping to find tollbooth change or earbuds even if nothing is visible. Park out in any decent outlying neighborhood and take an Uber into the tourist destinations. There's no place to park in the tourist areas anyway, during tourist season. It's not a car-friendly urban design. Oh and the cable cars are fun. Golden Gate Park has several great museums as well as a lot of open space. Recommended. But Uber for the last mile, too, instead of wasting an hour trying to get rid of your car.
Sacramento's Railroad Museum is a must-see if railroads are of interest to you. This was originally the terminus of the transcontinental railroad so there's a lot of history. One of the biggest locomotives in the world is there. 2-8-8-2, and cab-forward for the many tunnels and snow-sheds over Donner Pass.
Donner Pass and driving around Lake Tahoe is another long day trip from where you will be. Spectacular scenery. But check Google traffic to see if this is practical mid-summer.
This is getting too long-winded so I'll stop here. The entire region is my 'back yard' and I love it. YNP has been the site of extended family annual gatherings, coming from all over, since I was too young to remember. Grandpa was a mine superintendent at Bodie. Uncle wrote his PHD thesis mapping the underground ore bodies at Virginia City. I worked on survey crews at Squaw Valley and early Alpine Meadows (Lake Tahoe region) 60 years ago. Recall having to back up and try several times to get a worn out VW transporter (bus) up the steepest parts of Old Kingsbury Grade, Gardnerville in Nevada to South Tahoe. We've snow-shoed in to a friend's family cabin at Silver Lake, off SR88, Carson pass. My covered wagon ancestors winched their wagons up the eastern side of that pass to get to California.