Rotherham started the game brightly, and looked the sharper of the two sides for much of the early stages, but they missed a good chance to take the lead when Matt Derbyshire headed over from Ben Pringle's corner.
The home side would regret missing the opportunity as Cardiff broke the deadlock against the run of play when Bruno Ecuele Manga found space at a corner to power a header home.
Rotherham were shocked by the setback after making such a promising start, and they fell further behind when Federico Macheda volleyed home on the turn in the box.
The hosts attempted to get back onto the front foot in an end-to-end start to the second half, but Cardiff looked comfortable protecting their advantage.
Collin was forced into action to keep out a fourth with a fine double save as both McAleny and Alex Revell were left frustrated by the Rotherham shot-stopper.
A lapse of concentration from the Cardiff defence allowed Danny Ward to head home from Adam Hammill's cross late on, but the visitors held on to secure all three points.