Stocks gained encouragement from lower oil prices as investors weighed the latest developments in the Middle East.