It sounds to me like your painful bowel movements might be caused either by severe constipation, or in case you have regular bowel movements, you might be suffering from hemorrhoids. So, the first question I have to ask you is - do you suffer from constipation? It can be caused by number of things, from painkillers, diet or some health conditions. If you can tie any of these changes to the 4 months period when the problem started, than you might find some relief in eliminating that cause, together with diet and fiber supplements that would help to at least make your stool softer so it doesn't cause as much pain as it does now.
In case you’re having hemorrhoids, you first need to confirm this with your physician or GI doctor, but the treatment for hemorrhoids very much depends on the stage and size.
Wish you all the best,