Many boats have what are called docking lights. They are there to assist while docking. They are legal to have if used for the intended purpose. Many, including me, have used them at times at night to help watch for floaters. The key to using them safely is to make sure to turn them off as soon as you see a boat in front of you. I've passed water patrol once in the no wake zone where they could see I had them on but turned them off as soon as I saw the docks (not even knowing water patrol was waiting) in front of me and they didn't stopped me. On the other hand, I know of a case where someone didn't turn them off, and while water patrol didn't give them a ticket (as they certainly could have) they got stopped and got yelled at.

As for when to keep at least an anchor light on, I don't thing there is a magic distance from the shore that detirmines if its a navigation area or not. If I am anywhere in an area where boats can plane, at least the anchor light is on, and I usually leave them all on if I am moving at all. If its back in a cove I can see turning them off but I usually just leave them on regardless. If leaving the light on costs me some fish, and I seriousy wonder if it ever has, so be it. Its just not that big enough of a deal where its worth risking the safety of me or someone else. There is a reason people get tickets for not having them on.