There is no perfect treatment for pain and sleeplessness. It all depends on your particular case -- the kind of pain you have and the other medications you take, for instance.
The first step for anyone with sleep problems is to improve their sleep habits. This helps set the stage for a good night's rest.