Tesla shareholders should use any rallies in the electric car maker's stock to get out, according to one top Wall Street firm.

Morgan Stanley reiterated its equal weight rating for Tesla shares, saying Amazon may lower transportation logistics costs, hurting the company's trucking opportunity.

"We expect that Tesla will successfully overcome bottlenecks and ramp Model 3 production throughout 2018. The boost to cash flow and sentiment provides a selling opportunity before facing further headwinds," analyst Adam Jonas wrote in a note to clients Friday.

"Where we have substantially higher conviction on the Tesla story is our longer term thesis that the company will face greater levels of competition than the market anticipates in the domains of electric vehicles, autonomous vehicles, and shared mobility."

Jonas reiterated his $379 price target for Tesla shares, representing 15 percent upside to Thursday close.

The analyst is concerned over the rising risks from other companies. He said Amazon could have a negative impact on the transportation logistics market and Alphabet's Waymo may hurt Tesla's future autonomous car opportunities.

Tesla unveiled its electric semi truck in November. CEO Elon Musk said he expects the semi will give truckers a better experience, while increasing safety and reducing costs.

"Amazon has a vested interest in taking the marginal cost of transportation to its lowest possible level," he wrote. "We're in no position to say whether Amazon would be a partner or a potential competitor to Tesla in the area of transport, trucking, and logistics, but we point out the scale that large e-commerce players can bring, which could lead to surprisingly deflationary long-term trends in some of Tesla's core initiatives."

The electric car maker's shares are outperforming the market over the past 12 months, up 34 percent through Thursday compared with the S&P 500's 16 percent return. Jonas believes the future may be more difficult for investors in Tesla.

"To summarize, for the past seven years, Tesla has nearly monopolized Auto 2.0 amongst the publicly traded OEMS. In our opinion, the next seven years may be a far more volatile and crowded narrative," the analyst wrote.

Tesla did not immediately respond to a request for comment. Its shares were down 0.8 percent Friday morning.

— CNBC's Michael Bloom contributed to this story.