Like the iPod, the iPhone's battery is not user-replaceable, and must officially be replaced through Apple's own iPhone battery replacement program (though third-party battery replacement programs, like those for the iPod, are sure to appear soon).
The program will cost a total of $86 (a service fee of $79, plus $6.95 shipping). That's $20 more than the iPod's battery replacement program.
Like the iPod battery replacement program, iPhone data will not be preserved in the process. Apple says:
"No, the repair process will clear all data from your iPhone.Â It is important to sync your iPhone with iTunes to back up your contacts, photos, email account settings, text messages, and more.Â Apple is not responsible for the loss of information while servicing your iPhone and does not offer any data transfer service.Â Please do not send any accessories with your iPhone. [...] The repair process normally takes three business days."
Apple currently offers the following iPhone battery-related Knowledge Base documents: