A simple replace should do it:
// removes duple spaces
$result = str_replace(" ", " ", $tags);
// removes space after comma
$result = str_replace(", ", ",", $result);
but yes, regular expression would be better I guess... something like (,[ \s]+)
and replace with ","
sorry but not time to test the regex for u know, i'm in a hurry