You cannot actually prevent them from entering your pool, since they can fly. However, you can make your pool far less attractive to them, by eliminating their food sources:

1. Kill all algae.
2. Make sure your pump and SKIMMER is running at night.
3. Turn off or block lights from shining on your pool. (The lights reflect, and the reflection attracts bugs.)