This can be caused by a lot of different things - a urinary tract infection, a pinched nerve, an enlarged prostate, dehydration.
The easiest thing to try is to drink more water - don't go over a liter a day, but try increasing it. Ease off any caffeine, alcohol, juices and carbonated drinks.
If you don't feel a big improvement in a couple of days, see your doctor.