Take I-94 out. When you pass Billings, MT, you'll come to Laurel, MT; exit there. This is highway 212 which takes you over Bear Tooth Pass. From there you have a few options: you can head to Yellowstone, you can loop back to I-94 via highway 89 which will take you back to Livingston, MT (amazing views) or you can take 191 back to I-94 which follows the Gallatin river up to Bozeman. It mostly depends on if you want a scenic drive or a day or two of other activities.
I-94 is actually very beautiful to drive through Montana, so no need to venture off to any back roads. From there I'd get off in Missoula and take highway 12; this heads west into Idaho via Lolo Pass. I took this on accident many years ago and it's an unbelievable drive. I was heading to Bend (central Oregon), so I headed south at Kooskia. You can continue on 12 which takes you into Walla Walla and eventually you'll end up in northern Oregon. The route I took takes you down 95 which borders Hells Canyon.
You've got a lot of options, but if it were me I would make it a point to see part of Montana/Wyoming on the drive out.