Although I live in Wyoming, I've biked into and out of Yosemite at least a half dozen times. There are three main options from the Central Valley. Hwy 120 comes in from the west via Manteca, Hwy 140 comes in from via Merced, and Hwy 41 comes in from the south via Fresno. Modesto is kinda in between the first two.
Hwy 120 and Hwy 41 have a LOT more climbing. They get to more than 6000 feet before dropping dramatically into Yosemite Valley at 4000 ft. Hwy 140, on the other hand, follows the Merced River up into the Valley with a big climb just as you enter the park. Also, Bay Area folks usually use Hwy 120 and Southern Calif folks use Hwy 41, so Hwy 140 usually has much less traffic.
Hwy 120 - about 13000 west of Don Pedro, about 4000 east of Don Pedro.
Hwy 140 - about 5000 west of Mariposa, about 2000 east of Mariposa.
Hwy 41 - about 18000 west of Oakhurst, about 5000 east of Oakhurst.
If you make a loop. it would be easier heading into Yosemite on Hwy 140, then heading out on Hwy 120 - but there are tunnels and a huge climb heading west out of the park on Hwy 120. It is really hairy going uphill thru those tunnels. Also, it really sucks losing all of the climb on Priest Grade while you are smoking your brakes. Of course, it really sucks worse climbing Priest Grade. I haven;t ever ridden Hwy 41 - I might ride the section within the park one day - but not as a way of getting into the park.
Other options? Hwy 132 east from Modesto is an option, although I'd take back roads to La Grange. East of La Grange Hwy 132 only has about 2000 vehicles per day. Then you can cut south on Hwy 49 from Coulterville to Mariposa and catch Hwy 140 into the park. Or do it backwards. J-16 to Hornitos is really nice, then Hornitos Road and the Old Toll Road to Hwy 49 just outside Mariposa. From Merced, you can get off of Hwy 140 onto the Old Highway at Catheys Valley. This road is a gradual climb to Mariposa with very little traffic and nice shade.
Camping? Make sure to use the backcountry campground (Not Camp 4!) in Yosemite. The park does not advertise, but persons entering the back on a bicycle are eligible to use this car-free campground on a bend in the Merced River. Also, many temporary personnel are unaware of this. I received written confirmation from the head backcountry ranger. Really nice camping in to park. Outside the park there are National Forest and BLM campsites on most routes - although in the canyons there isn't any level ground for camping.
Here are two forest service maps - -
Feel free to ask me any other questions.
Best - J