Firstly it is important to remove anything that might be attracting the fox into your garden or back yard. Make sure food waste is secured in your rubbish and if necessary relocate your rubbish bin to another area.
Foxes are not classified as a pest or vermin and infact anyone who illegally harms a fox could face a fine and even a prison sentence. For this reason traps or devices that harm foxes are not a good idea. You may use fence spikes or chicken wire to keep them out though.
An slightly odd sounding fox deterrent is to urinate around the borders of your garden or in particular where they are entering your property. This is a very effective detterent if done regularly, it must be maintained for a fox to learn that this is no longer his territory. For it to be a success keep urinating on a daily basis in the area for at least a couple of weeks. If this sounds like too much of a committment then you could use Scoot Fox Repellent that works in the same way. Foxes dislike the smell of Scoot as it interferes with their own scent markings, they believe another animal is using their territory.