It is mentioned Here
But I also copy it here
Typically this is caused because you have categories or products with duplicate urls. i.e a category with www.example.com/hats and a product with same url. Every time you save the product you will incrementally increase the core rewrite. The number you see at the end of your URL. The other main culprit is configurable products.
Make sure the URL you’re trying to achieve is in fact unique.
There is a reason Magento appends these numbers to the end of your URLs, because it actually already exists. It’s like creating two categories with the same name in WordPress, the second category will have the URL “/category-2/”.
Step 2 Do a database backup
Open up PHPMyAdmin or something similar.
Find the Core_url_rewrite table.
Search for your url in the request path. In my example I typed: ‘hats%’ this will find anything beginning with hats in the url.
Just remember if you hard linked this page it will now 404. So if there is a risk of this, make sure you create a new redirect after this for that page.
Delete all rows from the search results.
Reindex your Catalog URL rewrites.
Go back to the category or product and click save.
Your urls should now be as desired!
The upgrade will help with the underlying cause of this, but will not correct it. You will still need to run through this process regardless.