next_post_link() have an option to restrict adjacent posts to the current category. This plugin takes one step further:
If you visit an archive page (category, tag, date, author, search etc.) and then visit a single post from that page, the
next_post_smart() will point only to the other posts in that archive page.
This is particularly useful for photoblogs (that’s where I use it).
If there isn’t an adjacent post, it will use the normal template tags.