The key does not have a battery, it uses RFID(radio frequency identification), when you turn on the key switch the computer sends out a Radio Frequency "blast" from the antenna around the lock cylinder(the wand), this "blast" gives the RFID tag inside the key enough power to send out its ID number, computer reads this number, via the wand, and looks at it's list of the 2 or 3 key numbers programmed into it at the factory, if the number is found then engine will start.
These keys for some reason can start to be hard to read, shouldn't happen but it does.
But yours is still working, all be it intermittently, a less expensive option is to "clone" your working key.
Many Locksmiths have writable RFID Ford blank keys, they can "read" your key to get it's number(ID) then program 1 or 2 or ?? other keys with that same number(cloned).
Then cut the key to fit your lock.
This can be done at their location, but having the truck outside to test if it works would be best.
Call for local prices on this.
The above assumes the key is the problem, and since you don't mention trying another key I also assume you don't have another one to try, if you do then use that one to see if it is a key problem.
If not then first step would be to clone current key and see if that helps, if it doesn't then could be a "wand/wiring" issue or computer issue.
Some locksmiths can also add new RFID keys to your computer, this would be more expensive, as they need to hook up their computer to your trucks computer to do this.
This is usually only done when someone loses their last RFID key and it is either call a mobile locksmith or have truck towed to a Dealer to have another key added to the list.