I recommend that you start your trip in Prague and take the overnight sleeper train from Prague to Budapest. It leaves Prague at midnight and arrives in Budapest at 8.30am. It's modern, clean and comfortable, and inexpensive when booked in advance. I took it three weeks ago and I was very impressed.
It's timed perfectly. It leaves Prague at 23:58, so you have a full day in Prague and then simply go the main train station at bedtime, get on to the train and get into a real, made-up bed. The conductor comes by to tell you that he'll wake you at 8am and then off you go to sleep. By the time you wake up, you're in Budapest. As the stations are in the city centres, so no mucking about in airports, it's hassle-free and super time efficient and it saves price of a hotel for the night. It couldn't be better!
(Unfortunately, it doesn't work as well going the other way, as the overnight from Budapest to Prague leaves at 20:05, which means it eats up most your evening.)
Check out the Man in Seat 61's website for more about train travel.