Paracetamol is fine in the stated doses throughout (usually, 1000mg 4 times a day usually, check packet). But basically, persistent pain (anything over 24h etc) should be investigated.
Codeine needs to be taken only with a prescription and preferred that you don't take it during 1st trimester and late 3rd. If you have pain that requires codeine, you should def. get it checked out.
NSAIDs [ibuprofen, asprin, diclofenac etc] (paracetamol is NOT an NSAID, even though some HCPs still think it is. In some countries it used to be classed as an NSAID) should be avoided, but is sometimes prescribed in 2nd trimester.
Headaches/migraines suck (the pain I get during pg is a lot less than not-pg, but it's still migraines apparently! Just headache and flashing lights rather than a full-blown aura).
I found low blood sugars (take biscuits to bed and eat one if you wake), being dehydrated even slightly (so taking water to bed and making sure every time I wake, drinking 1/2 a glass and signifcantly upping water during the day) and my usual migraine triggers (strip lights, caffeine, blue cheeses, raw tomatoes and citrus fruits) all triggered migraines and headaches.
Also, try keeping cool at night. You can try things like 4head to help you through the pain too. Some gentle exercise every day might help too.
Have you seen anyone about treatment? If in 2nd trimester on, then headaches need investigating. So long as you've been checked for PE and they're monitoring the headaches, not to much to worry about, as they are very common. BUT it's worth possibly investigating a diagnosis of gestational migraines if they're flooring you for hours at a time.