You've actually posed an excellent question. And quite a few of the responses above have some great ideas.

I'd be tempted to try the following:

1. If you sleeping in a makeshift shelter such as a lean-to, locate the shelter to minimize problems from the wind and cold.

2. If possible, line the inner wall of your lean-to with a foil survival bag. I'm not a big fan of these bags as "sleeping bags", but they are great for reflecting heat.

3. Construct a small fire on the ground immediately beside your lean-to. You will get direct heat from the fire, plus reflected heat from the foil that you put on the inner wall. Since the inner wall is sloping outwards, it will tend to capture more heat and reflect it downwards directly onto your sleeping position.

4. Pile up a some smooth small rocks on the opposite side of the fire, so these also reflect some heat towards you. Later on, if the fire goes out - you can put these warm rocks inside your sleeping bag, or if they are very hot you can bury them in the ground beneath you where you are sleeping.

5. If you have a couple of larger pieces of wood that you can burn, try making one of those survival fires where you only burn the wood logs end-on. So it's only the end of the firewood that is actually on fire, and as time goes by you slowly feed the log into the fire zone. This preserves your fuel, and also makes it easier for you to adjust the fire and keep things burning slowly during the night - in fact you don't even need to get out of your sleeping bag to do it. You can just roll over, push the wood (lengthwise) a little bit more into the fire, and doze some more.

Great question!
My suggestion is this ... next time you are backpacking go and try out these techniques. Let us know what you find out!

Pete