Jo Kuffour gave Brentford early hopes of their first win in nine when he broke forward and produced a fierce shot from long range but the rising effort was well over Neil Cutler's bar.
But in a scrappy opening spell, Williamson curled in a testing cross after a short corner for Rotherham but Pablo Mills couldn't reach it with his head.
Paul Brooker pounced when the ball broke kindly for him and snapped off a long-range effort that flew over Cutler's bar, before Rotherham's Ritchie Partridge had two chances in as many minutes, hoisting one over the bar and seeing Nelson save well again.
And when a free-kick came Rotherham's way, Williamson curled an intelligent dipping shot that almost crept under the bar but Nelson had it well covered.
Two minutes into the second half Rotherham went ahead with a stylish finish from midfielder Williamson.
Hoskins did superbly trying to force his way into the area and Adam Griffiths bundled him over for a free-kick and earned a booking.
And 12 minutes later it was Williamson who hit Rotherham's second with an emphatic penalty after Will Hoskins was brought down by Adam Griffiths.
Delroy Facey came within a whisker of a third when his diving header hit the post in the dying seconds.