Pagination issue in archive.php

You should not be setting the posts_per_page value in the template, nor should you be setting the object property directly after the query has run. That is going to cause the object data to become out of sync with itself.

You need to alter that value with a filter on pre_get_posts.

function pregp_archive_ppp_wpse_108225($qry) {
  if ($qry->is_main_query() && $qry->is_archive()) {
      $qry->set('posts_per_page',5);
  }
}
add_action('pre_get_posts','pregp_archive_ppp_wpse_108225');

The precise conditions you need may be different from the above example. You may need, for example, is_page_template() instead of is_archive().