The 37-year-old has agreed personal terms on a one-year deal with the Hammers with an option for a second year, and will move to Upton Park when his Wanderers contract expires at the end of the month.
The former Finland international told West Ham's official website: "I'm delighted to be joining West Ham United. After spending 15 years in Bolton it's a great new challenge and I'm really looking forward to it.
"Everything has happened really quickly. When the opportunity was offered to come to West Ham I didn't think twice and I just told my agent to sort it out as quickly as possible.
"I appreciate Bolton giving me permission to speak to West Ham before my contract was up and for the efforts the chairman made in trying to get me to stay.
"I would like to thank the fans for all their support over the years and I wish the players and, in particular, (manager) Owen Coyle all the best in gaining promotion at the first attempt."