They can, but they don't. Although feathers are good insulation, the eventual temperature loss would be to much. When they are asleep the lack of muscle usage would cool them down even more. They sleep on the banks. Some ducks sleep in trees, although not your local mallard or teal.
They do however frequently have a catnap on the water.