See the strip_html() function, which will allow you to specify a list of tags that you consider safe. It will prevent users from embedding Javascript, PHP code, et cetera.
It does not, however, validate the input HTML. A user could open a <b> tag and not close it, et cetera.
I think you could write code using the XML parser that would count open tags and let you ensure that they are closed, but I have not tried it.