Sleep, a period of rest when the eyes are closed and there is little movement or thought, is a human definition and one that doesn't accurately describe how fish rest.
However fish do 'sleep' in their own way, having distinct periods of activity and inactivity. Minnows for example are very active in schools during the day, whereas at night they scatter and remain motionless in shallow water.
Some fish have to keep moving and float around, some wedge themselves into a spot in the mud or the coral, and some even build themselves a nest. They don't 'close their eyes' because they haven't got eyelids - except sharks.
Some fish are so large that they don't need to protect themselves while sleeping. However, others have elaborate ways of keeping themselves safe: tropical parrotfish exude a jelly-like substance, which expands on contracts with seawater, forming a protective bubble around the fish while it sleeps.
Coral reef fish, which are active in the day, spend the night tucked away in the coral to avoid being eaten.
Some actively swimming fish like tuna can never stop swimming because they need to propel themselves forward in order to push air through their gills. But they do slow down during rest periods and enter a daydream like state.
Some fish undergo a yearly sleep cycle when their metabolic rate slows down allowing them to hibernate.
The African lungfish gets through the harsh dry season by burying themselves in the riverbed mud until the rains come.