Question: Character A (2 HD) has two stirges (1 HD each) attached to him. Character B wants to cast sleep (can affect up to 4 HD), but only on the stirges.

Is it possible to center the spell so only the very edge of the radial area affects the bad guys and not the player?

Answer: 
Can you target sleep at particular creatures?
=============================================

**No**, [sleep](http://www.d20pfsrd.com/magic/all-spells/s/sleep) has an area effect and doesn't allow you to choose creatures as targets (you instead choose a point in space). Everyone in the area of effect is potentially affected.

However, the 4 HD limit and its rule that it affects lowest HD creatures first means that sometimes you can cast it on an area that contains both allies and enemies and be fairly sure that it will only affect the enemies. In the case of two stirges attacking a character, two [stirges](http://www.d20pfsrd.com/bestiary/monster-listings/magical-beasts/stirge) have 1 HD each and so will soak up 2 HD of the effect's limit. Therefore if the character they're attacking has 3 HD or more, the stirges will be affected by the spell but the character they're attacking won't be.

In the case you present, where the character being attacked has only 2 HD, they will be affected by the spell and have to make a saving throw to avoid falling asleep, just like the stirges.

Can you place the area of effect of sleep to only affect the stirges?
=====================================================================

**No**, the stirges occupy the same space as the creature they are latched onto. Once a stirge has attached to a creature and started to drain, it's too late to use clever placement to catch only the stirges in the area of effect of sleep (or any other AoE spell). Character B would have had to cast it on an area containing only the stirges before they had latched onto character A.

In *other* situations, sleep can affect only your enemies by clever placement of the centre of its effect, yes, assuming the allies and enemies are not inconveniently placed to make this division impossible.
Not be default. The spell is pretty clear in what it does, and it says 

> 
> A sleep spell causes a magical slumber to come upon 4 HD of creatures. Creatures with the fewest HD are affected first. Among creatures with equal HD, those who are closest to the spell's point of origin are affected first.
> 
> 
> 

So that's all there is to targeting it. If you want to hit certain creatures but not others, you might be able to fiddle with *where* you put the spell due to its limited range, and if character B has more than 4 HD, he can't be hit by sleep so he'll be fine, but otherwise he's going to be potentially affected, just like the Stirges.