Welcome to the Apple Community.
Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
Refer to your router manual for instructions on changing your wifi channel.
There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first. In some cases resetting the router or Apple TV may temporarily resolve the problem.
I had the same issue, it was working fine then suddenly it was telling me to turn on my home sharing, which was already on. I followed the advice of Winston Churchill by first resetting my router, and then I went into ATV settings and reset my WIFI settings. This restored my homesharing capabilities and all is well so far. Hope this works for you.