If you crazy about valid html warnings and such, then replace "&" by "&"
Code:
<a href="gallery/{$gallery.description|strtolower|treplace_special::'-'}.html?id={$gallery.gallery_id|urlencode}&u={$gallery.gallery_url|urlencode}" target="_blank">