Parts of Oceanside, Vista, and San Marcos will have the combination of open space, good schools, and beach proximity you seek in the under $400,000 price range. You just need to drive the neighborhoods and ask local agents for the good areas.
Carlsbad and further south the prices near the coast go up, so those probably won't work. Rancho Bernardo and Poway may have some options, but they are further from the beach(10-15 miles).
I'm not as knowledgeable about Chula Vista or Allied Gardens for example, but they will put you closer to downtown San Diego and could meet your needs.
We made the move from SF in 2002. There are some good points and bad points no matter where you live, but I'm sure you will find the overall quality of life is better here.