My Mac's hostname keeps adding a "-2" to the end
This is a known bug with the discoveryd process on 10.10 Yosemite. Recent rumors is that it will be replaced by its predecessor, mDNSresponder, come 10.10.4 to help alleviate network issues. Although the actual cause is unknown, it has been said that it is related (at least in part) to improper name resolution in DNS when the computer wakes from sleep. It sees itself as a duplicate on the network, and as such it appends the suffix to the title.

While there are some "fixes" YMMV - It's probably best to just keep renaming it the way you do, and then wait for the next release of OSX to come out and fix it so you don't sacrifice any functionality like Wake on LAN.

Source