It’s extremely vital to maintain a good posture when you are doing your work. My bad posture at the desk is costing me; neck aching (I think my nerves are causing the pain).
Sit properly, no slouching, don’t be lazy (pull the chair closer to the desk) and make sure the neck is not strained.
Get a good chair. A nice comfy one that covers the base of your neck (at the very least).
Exercise. Take breaks after every 15 minutes of work done.