There are many good resources described in the comments to your question (1 & 2). One that combines many different types of financial products and has some open access is Quandl.
Quandl provides a single easy-to-use API for stock prices and fundamentals. Coverage includes end-of-day prices, harmonized fundamentals, key financial ratios, earnings estimates, analyst ratings, price targets, indexes and more.
The API comes with 3 levels (1 open/free, 2 paid). The open level is based on community maintained data (details).
End of day stock prices, dividends and splits for 3,000 US companies, curated by the Quandl community and released into the public domain.
History to 2004.
In addition to Quandl, I've also had a good experience using the Markitondemand API (documentation). Their interactivechart endpoint can give you historical data.
If you use programming languages like Python or R, you can automatically integrate historical data via the public feeds (i.e yahoo, google, quandl).
Python Quandl module
mydata = Quandl.get("NSE/OIL", authtoken="your token here")
R Quandl example
library(tseries) # Loading tseries library
mtgoxusd <- read.csv('http://www.quandl.com/api/v1/datasets/BITCOIN/MTGOXUSD.csv?&trim_start=2010-07-17&trim_end=2013-07-08&sort_order=desc', colClasses=c('Date'='Date'))