It's safe, but in my opinion, you should avoid Rt. 116, which unfortunately is the most direct way to get from Petaluma to Sonoma. The way to avoid it is to go further north, then head east via Sonoma Mtn. #2.
To get to SF from Petaluma, you could use the (very detailed) route sheet here
, which starts at the Golden Gate Bridge.
Using it, you'd follow the directions until you get to the 50.0 mile mark, a RIGHT on McDowell. Instead of taking that RIGHT, you should just continue straight on Washington until you hit Adobe. From there, you could use this route
to get to downtown Sonoma. (I've ridden this route up until the point where you turn left on Verona....so from that point on, I was just basing the route on what roads will take you to downtown Sonoma, rather than what roads I have experience with. But at that point you're in residential neighborhoods, so the roads should be fine to ride on.)
As you can see from the map, this Petaluma to Sonoma route looks like a major detour from using 116, and it is, complete with a fair amount of climbing. But it's very scenic, and the downhill stretches are a lot of fun. And most of all, it allows you to avoid 116, which is a two-lane highway with rumble strips, little to no shoulder, and heavy, high-speed traffic. I rode 116 once, and once was more than enough. It's not a pleasant road.