You have a few options.
One, put your phone into sleep mode. I just did my first century a few weeks ago, and I used my iPhone to track my route. Normally, I ride with the screen on (at full brightness) which burns through the battery in about 3-4 hours. On the century ride (7 hours ride time), I only used about 40% of the battery by leaving it in sleep mode.
Two, as dabac suggested, you can carry a battery. I have also done this. I had a car cigarette lighter socket laying around, so I added some alligator clips to its leads, then clipped those onto a cordless drill battery (14.4V). Then I plugged in a car charger for my phone. This was my cheapest route for extra battery capacity as all I needed to buy were the alligator clips for a couple dollars. I already had everything else.
Three, there are small lithium-ion booster packs for virtually every phone out there, but they are spendy--generally I've seen them anywhere from $30 up to $100 or more. I've used a cheap one in the past (not for biking), and it only lasted a few months. The reviews I've seen online are generally not good for the all the cheap ones, and some of the more expensive ones.
Four, a dynamo--either a hub or mounted to the fork, running off the tire. These tend to be heavy and not very efficient, so they slow you down a bit.