Please see http://www.seat61.com/international-trains/trains-from-Budapest.htm#Budapest-Prague:
"You can try to buy tickets for this train at the Hungarian Railways site www.mav-start.hu, but this may or may not currently book this train. Bookings open 60 days ahead. See tips for using mav-start.hu & how to collect your tickets.
If you don't see this sleeper train in the online search results, you'll just have to book at the international booking office in Budapest. It's unlikely to get fully-booked, but obviously you'll then pay full-price close to departure date. It'll be cheaper to go with a day train from €19, but then the sleeper does save time and a hotel bill."