After Prague and Vienna - I would definitely do Budapest as the third city.
Also, if travelling by train, they form a convenient triangle, with direct trains between each of the city pairs.
Approximate daytime journey times:
Budapest - Prague 7 hours
Prague - Vienna 4 hours 30 mins
Vienna - Budapest 3 hours.