I'd say take the train, from this site:
There is only 1 direct train between Krakow (Poland) and Prague (Czech rep.) and it goes overnight. It is also possible to go to Katowice (PL) or to Bohumín and there change to the train to Prague.
TLK 402 Silesia, dep 22:03, Arr: 07:37. 45€ seat, 55€ couchette / bed.
Schedule valid from 2013-12-15 to 2014-12-14
That's a six bed couchette, further down it has prices for other options. Most expensive looks like a single room deal at 96 Euro. I've taken a similar train in normal seats, it's not too bad but given that it's overnight you're saving the price of a hotel so factor that in.
That page also recommends the bus, details on this page. But honestly, unless timing is critical or you really need cheap as can be I'd take the train.
You can book tickets online or any travel agent or someone at the bus station there will be able to help you
Seat61.com has some more info on this page including some other ticket buying options.
Also, a word of warning, I haven't taken that specific train but have attempted to take a different train bound for Krakow. What I didn't notice is that some point in the middle of the night the train split and each half went different places ... so I woke up in Warsaw. So, just check if there's a specific part of the train you need to be on.