You and the neighbor can agree on where you want the line to be and make a "lot line agreement" between yourselves. Then you make it official by signing deeds that describe the boundary. If you decide to do this, make sure you research local zoning and subdivision laws that you may need to comply with.
If you have a mortgage on the property, consult an attorney for help in drawing up the deeds. You may need to get the permission of the mortgage holder before you give your neighbor even a tiny piece of the land.
Once you have signed a deed, you should record (file) it at the county land records office, usually called the County Recorder's Office, Land Registry Office, or something similar.
To learn more about deeds and boundary agreements, check out Deeds for California Real Estate, by Mary Randolph (Nolo), which contains sample deeds, and Neighbor Law: Fences, Trees, Boundaries & Noise, by Cora Jordan (Nolo), where you'll find more details about boundary agreements and a sample written boundary agreement.
If a neighbor starts to build on what you think is your property, do something immediately. If the encroachment is minor -- for instance, a small fence in the wrong place -- you may think you shouldn't worry. But you're wrong. When you try to sell your house, a title company might refuse to issue insurance because the neighbor is on your land.
Also, if you don't act promptly, you could lose part of your property. When one person uses another's land for a long enough time, he can gain a legal right to continue to do so and, in some circumstances, gain ownership of the property.
Talk to your neighbor right away. Most likely, a mistake has been made because of a conflicting description in the neighbor's deed or just a mistaken assumption about the boundary line. If your neighbor is hostile and insists on proceeding, state that you will sue if necessary. Then send a firm letter -- or have a lawyer send one on his or her letterhead. If the building doesn't stop, waste no time in having a lawyer get a judge's order to temporarily stop the neighbor until you can bring a civil lawsuit for trespass before the judge.
You can hire a licensed land surveyor to survey the property and place official markers on the boundary lines. Professional organizations, such as the California Land Surveyor's Association (californiasurveyors.org), often provide useful information on how to choose and work with a land surveyor.
The cost of a boundary survey is determined by the size of the parcel, whether it is in a subdivision, when it was last surveyed, what region of the country it is in, and other factors. A straightforward survey may cost as little as $500 in some areas of the country. But be prepared to spend $1,000 or more if no survey has been done for a long time, if the parcel is large, or if the maps are unreliable and conflicting. In fact, many surveys cost thousands of dollars.