I know it can be very hard getting comfortable at night when you are pregnant.
First, may I suggest that you try to sleep on your side rather than your back during pregnancy? This is because when you lie on your back your uterus may put pressure on your vena cava – a large blood vessel that runs up your back returning blood to your heart. This may make you feel dizzy and faint, and may reduce the flow of blood to your baby. (If you find it very uncomfortable to lie on your side, tuck a pillow under your back, to one side, so that your body is tilted.)
You may find that lying on your side may also be more comfortable, because the pressure is taken off your lower spine. (The spine is under increasing strain as pregnancy progresses – generally because more women try to balance their growing bump by leaning back – and so deepening the natural inward curve of the spine.) Alternatively, putting a thin pillow – or small cushion, folded towel or rolled baby blanket – in the small of your back whilst lying in bed may give extra support to this area (and also tilt you to one side as described above). This extra support may, in turn, reduce the compensating strain on the joints of your pelvis.
If you choose to lie over on one side, try placing a pillow in front of your legs and bending your top leg so that it is supported by this pillow. Alternatively, you could put a pillow between your legs. Both of these measures help to keep the legs slightly apart and so reduce strain on the joints of the pelvis.