Hi, and thanks for your medical question on eHealth forum!
The pain in the back can be due to muscle pull or strain. Use a hot water bottle while sleeping and apply a local analgesic cream. You can also take an OTC pain killer. See if this treatment helps in a day or two. If it does not help, then an X-ray of the spine should be taken and you may also need a MRI. You will then need to consult an orthopedic specialist. Hope this helps. Take care!