Dow squeezes out third-straight month of gains as stocks close off lows

U.S. stocks closed lower Friday, as health care stocks weighed, but the major averages pared losses significantly for the Dow and S&P to post gains for April.

"I think you probably have a bit of a short-covering rally going into the weekend here," said Peter Coleman, head trader at Convergex.

The Dow Jones industrial average closed about 56 points lower after earlier falling 178 points. Home Depot and Travelers contributed the most to gains, while Wal-Mart had the greatest negative impact.

The Dow Jones industrial average posted a half percent gain for April, notching its first three-month gain since a five-month streak ended June 2014. ( Tweet This ) The S&P 500 gained nearly 0.3 percent in April, for its first two-month win streak so far this year.

The Nasdaq composite briefly attempted gains before falling for a seventh-straight day to lose 1.9 percent in April, its worst month since January.

Apple ended the day off lows, down 1.1 percent, but fell 14 percent for the month, its worst since January 2013. The stock is off nearly 11 percent for the year so far. closed about 9.57 percent higher for a monthly gain of 11.11 percent, its best since October. The stock is still 2.4 percent lower year-to-date.

"What we've seen so far this week, in terms of the market, we've seen a bit of a reversal of the risk-on rally we saw over the prior two months," said Jeremy Zirin, head CIO investment strategist, UBS Wealth Management Americas.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, spiked more than 10 percent to briefly hit 17.09, its highest since March 15.

As of Friday's close, the Dow and S&P were about 3.2 percent below their 52-week intraday highs, while the Nasdaq composite was 8.7 percent below that level.

"I don't think the read through on the pullback on the Nasdaq has significant ramifications on the overall market," Zirin said.

Health care fell nearly 1.5 percent as the greatest decliner in the S&P 500.

Gilead Sciences reported earnings that missed on both the top and bottom line. Pricing pressure in the hepatitis C market was among the factors weighing on the drugmakers results, although it did provide upbeat news for investors with a 9.3 percent dividend increase to 47 cents per share. The stock closed down 9 percent on the day, and down nearly 4 percent for the month.

"When a company like that is having such a bad day that's going to have an outsized impact on the IBB," said Brad Loncar, CEO of Loncar Investments.

The iShares Nasdaq Biotechnology ETF (IBB) closed 2.66 percent lower to post a 7 percent weekly decline, its worst since the end of January. The index still held gains of 2.7 percent for the month, its second-straight monthly gain.

The major averages extended opening losses after disappointing morning data. Chicago PMI for April was 50.4, below expectations of 53.0 and March's 53.6 print. The final April read on consumer sentiment was 89.0.

"Today's market action we're seeing a cross section of profit-taking ... and weakness," said Lance Roberts, chief investment strategist at Clarity Financial.

The U.S. dollar index fell more than half a percent Friday to post a monthly loss of about 1.6 percent, its first three-month losing streak since 2012.

The euro was last near $1.144. Earlier, the euro hit its highest against the dollar since April 12 and the dollar index fell to its lowest since Aug. 24, 2015.

The dollar lost nearly 4.9 percent against the yen for the week, its worst since October 2008.

The Japanese yen strengthened to fresh highs against the U.S. dollar, going back to October 2014, and was last near 106.4 yen against the greenback.

"The biggest surprise of the week was the Bank of Japan. We're still feeling the aftershocks of that," said Art Hogan, chief market strategist at Wunderlich Securities.

Ahead of the U.S. market open Thursday, the Bank of Japan kept policy unchanged, maintaining the pace of its asset purchase program and keeping steady its 0.1 percent negative rate it applies to some deposits. The central bank also cut its inflation forecasts and again pushed back the timing for hitting its 2 percent price target by six months.

Read MoreBOJ throws curveball, Japanese economy could strike out

It's "somewhat of a risk-off week probably led by the inaction of the Bank of Japan," said Eric Stein, co-director of global fixed income at Eaton Vance Management.

Gold jumped more than 2 percent in intraday trade to hit its highest in more than a year, going back to Jan. 26, 2015.

Gold futures for June delivery settled up $24.10 at $1,290.50 an ounce. Gold gained 4.44 percent in April, for its first four-month win streak since the one ended August 2012.

Read MoreEarly movers: AMZN, VRX, TIVO, TYC, DAL, VFC, MCO, NWL & more

In earnings news, reported earnings well above expectations on both the top and bottom line, helped by growth in its Amazon Web Services business. First-quarter earnings of $1.07 a share on $29.13 billion in revenue compares with last year's loss of 12 cents a share and $22.72 billion in sales.

LinkedIn's results also soared past expectations and the firm raised its full-year outlook. Shares closed nearly 1.9 percent higher, but are more than 44 percent lower for the year so far.

Chevron posted a greater-than-expected loss of 39 cents a share, while revenue beat expectations at $23.55 billion. That marked a roughly 32 percent decline in sales from the comparable year-ago figure of $34.56 billion. The stock closed 0.2 percent lower but are still up more than 13 percent year-to-date.

Exxon Mobil reported quarterly earnings and revenue that beat analysts' expectations. Shares posted a 0.4 percent gain and are up more than 13 percent for the year so far.

U.S. crude oil futures settled 11 cents lower, or 0.24 percent, at $45.92 a barrel after topping $46 Thursday for its highest close since early November. The weekly oil rig count showed a sixth-straight week of decline.

WTI notched its first three-month win streak since 2013 with a 19.77 percent gain in April. However, the commodity is still in bear market territory, off more than 20 percent from its 52-week intraday high.

"The price of crude oil has gotten completely detached from fundamental levels," Roberts said. "There's a bit of a detachment from oil prices in the market right now."

Read More'Sell in May and go away' might not work this year

In economic news, personal spending rose 0.1 percent in March, while personal income rose 0.4 percent. The Employment Cost Index, the broadest measure of labor costs, increased 0.6 percent after an unrevised 0.5 percent gain in the fourth quarter, the Labor Department said on Friday.

The Fed's preferred inflation measure, the ex-food and energy personal consumption expenditures (PCE) price index, edged up 0.1 percent last month. In the 12 months through March, the core PCE rose 1.6 percent after advancing 1.7 percent in February.

Treasury yields were mixed, with the 2-year yield near 0.78 percent and the 10-year yield around 1.83 percent.

"A little bit of a volatile day," said Guy LeBas, chief fixed income strategist at Janney Montgomery Scott.

"I think we're following equities a bit in the final trading hours," he said.

The Federal Reserve could raise U.S. interest rates as soon as June or July if second-quarter economic data is strong, Dallas Federal Reserve President Robert Kaplan said in a Reuters report Friday.

European stocks closed more than 2 percent lower, while major Asian indexes ended lower. The Hang Seng closed 1.5 percent lower and the Shanghai composite fell 0.25 percent. Japanese markets were closed for a holiday.

Overnight, China's central bank set the yuan midpoint against the U.S. dollar at 6.4589 in the biggest daily strengthening since 2005, when China removed its peg to the dollar.

On Thursday, the Dow had its worst day since February as a decline in Apple shares weighed.

Read MoreIcahn: We're out of Apple, and it's China's fault

The Dow Jones industrial average closed 57.12 points lower, or 0.32 percent, at 17,773.64, with Wal-Mart leading decliners and Home Depot the top advancer.

The Dow gained 0.5 percent for the month, with Pfizer the best performer and Apple the worst.

The S&P 500 closed down 10.51 points, or 0.51 percent, at 2,065.30, with health care leading seven sectors lower and utilities and consumer discretionary the only gainers. Telecommunications closed flat.

The S&P rose 0.27 percent for the month, with energy the top performer and information technology the worst.

The Nasdaq composite closed down 29.93 points, or 0.62 percent, at 4,775.36.

The index fell 1.94 percent for the month.

The Dow transports fell nearly 1.2 percent, for a monthly decline of 0.9 percent.

The Russell 2000 closed about 0.9 percent lower but held a monthly gain of about 1.5 percent.

Roughly three stocks declined for every two advancers on the New York Stock Exchange, with an exchange volume of nearly 1.3 billion and a composite volume of about 4.6 billion in the close.

High-frequency trading accounted for 49 percent of April's daily trading volume of about 7.00 billion shares, according to TABB Group. During the peak levels of high-frequency trading in 2009, about 61 percent of 9.8 billion of average daily shares traded were executed by high-frequency traders.

CNBC's Peter Schacknow and Reuters contributed to this report.