You are supposed to shift to neutral for safety reasons. If you get rear-ended, the first thing that will happen to you is that your foot will come off the brake pedal and the car will move forward from the impact, but then start accelerating under its own power.
You should also engage the handbrake, again for safety reasons. If your car doesn't have a handbrake, then you should shift into Park.
After dark, out of courtesy for other drivers you should avoid leaving your foot on the brake pedal, because the brake lights can be dazzling. You should shift into Park for added security.
From the POV of the transmission, there is slightly more wear when you shift from N-D and vice versa but if the transmission and engine are correctly adjusted, this should be negligable.