This pain seems to be related to the time you spend in bed. It is probably of musculoskeletal origin or due to nerve compression, which is related to your position(s) during sleep. Such nerve compression or stretching pain can occur during pregnancy and delivery. Because your pain is relieved when you get up in the morning suggests that it is due to the upright position, rather than to emptying your bladder. You may have an overactive bladder but this is probably not the cause of your pain.
I have three suggestions:
· Try sleeping in a different bed, with a pillow under the small of your back or in a seated position in some type of recliner.
· See a physical therapist for exercises or massage. They should also give you further recommendations regarding different sleeping positions that might relieve the pain.
· Spend some daytime in your bed to see if the pain recurs when in bed and is relieved by getting-up. This would confirm the relationship of the pain to the positions you assume in bed.
You might also consider taking a non-steroidal anti-inflammatory medicine at bedtime, such as ibuprofen. Do this only if there are no contraindications to your taking this class of drugs.
have you considered acid reflux? I sufered from this for years with constant chest pains - felt like a knife going in. Had an op to tighten the phincter and fine now. For about a week after the op I had pain in my right shoulder - it was transferred pain from the op site. What makes my think acid is possible is that when you stand gravity helps keep the acid down. Laying down allows it to flow "up" or along. Another thing I've had a few times is sharp pains under the ribs and in the intestines after strong antibiotics. Taking probiotic tablets (acidophilous etc as in yogurt) helped restore the bacterial balance and it went away after a few days. I always do this now after antibiotics.
My latest related episode was acute chest pains when laying down. Could hardly muve it was so excruciating. Dragged mself to the GP and by the time I got to see him it had gone. Standing up helped I think. Later I put it down to some dodgy onions I'd eaten - had some more that night and it came back. Had also been on antibiotics the week before. good luck