Fiber & fiber...
Without knowing more about your specific situation, it is hard to give you an exact answer..
. but for most people in the US on a western diet that is processed... increasing dietary fiber
to over 30g a day (yes actually count them) really helps. If it doesn't get better, or if you notice unusual masses, bleeding, or pain on passing stool... see your doctor for an evaluation and examination.
Answer assisted by Mike Moore, Medical Student