Do it right from the beginning is the best way to avoid future issues. That usually means hiring a lawyer.
The costs will range anywhere from $1k to $5k, depending on how complicated the structure is and how many stockholders there are.
You can also use Nolo Press or Legal Zoom if it's really simple.
It always costs more to go back and fix problems than to do things right in the first place. If you don't get things set up correctly you could open yourself up to personal liability. The cost of that is much greater than anything you would pay to a lawyer to get your business properly set up.
Legal fees in the range is $1,000-$5,000 are probably accurate. The actual cost will depend on your location and the complexity of what you are trying to do.
If you still aren't sure about getting a lawyer involved, call or email around and meet with a couple of small business lawyers in your area. Most will be willing to meet with you to explain the costs and what they can do, and it will allow you to decide whether you want to hire a lawyer or not.
If you use something like LegalZoom, remember that you are only buying a form and there is no guarantee the form is best for your unique situation.
This is not an either/or situation. It is not either you do it yourself, or you contract it out.
Cost Benefit Analysis Each particular situation requires a cost/benefit analysis based on the potential risk, cash position, and stage of development of your company. Your industry and nature of your product/service is also immensely relevant to the cost-benefit analysis of in-sourcing or outsourcing legal.
There are many items like an NDA or a sub-contractor's agreement which it usually makes sense to leverage "google" or a low cost provider. There are other items like a PPM where you will need specialized legal support.
Random Points In general as you do your cost-benefit analysis remember that "cash is king" and "lawyers don't work for equity."
The most important lesson when working with a lawyer is to remember that they are "of counsel" -- not of "direction" Be sure to remember who works for who.
A Strategic Choice It is also worth noting that a trusting relationship with legal counsel can be one of the most important relationships for the sucess of your start-up. The right legal counsel can open doors to investors -- and build the confidence of investors that you are a professional team worth taking a risk on. The right legal counsel with start-up experience can ensure that you only invest money (and time) on the critical path documents/decisions. The right legal counsel can make 'trusted-adviser" referrals to qualified sales leads.
(The same of course is true for the "right accountant", "right marketing consultant", "right sales professional" -- but the question was about lawyers)