Here are three strategies to deal with demons, or, more generally, any malignant supernatural being, or psychic lifeform encountered during dreams or mental travels:
1. Kabbalah method (thanks to Charles):
Project love and acceptance towards the being and you may well find it just proves itself to be a rejected part of yourself, called evil, but really just 'unwanted', the being will become a helper/ally or even, in extreme case will merge with you and be reabsorbed back into the self-stuff.
Advantages: good for a loving path or bhakti yoga.
Disadvantages: softens the ego and fosters watery feminine qualities.
2. Tibetan Buddhist Method (thanks to The YES book catalogue):
Take a deep breath or inwardly imagine your psychic self taking a deep breath, and then turn to the necrospawn and suck in a powerful indraught of air, you are aiming to suck the demon into your lungs like smoke where you will spiritually digest the entity and use the mind-stuff it was created from to nourish your own being.
Advantages: gives a brief 'high', moves you beyond good/evil duality.
Disadvantages: Can cause big-headedness if done often.
3. Ancient Roman Method (thanks to Geoff):
Muster a huge supply of will power and angry desire to reject, focus your attention on the spirit being and then attack with a huge burst of furious aggression, crying "Fuck OFF !" your majesty and power as a human being are more than a match for any inhabitant of the lower or middle astral , the demon should trouble you no more !
Advantages: also works well with unwanted people
Disadvantages: strengthens ego-energies and worldly toughness.