Depending on age, try Newton
As the others have noted, success in choosing a school would be a great conversation to have with both Somerville/Cambridge parents as well as administrators from schools to help guide your expectations.
Personally, I feel that the best gauge of a child's success in school is largely determined by parental guidance and support. From that perspective, regardless of the school system, your child is already at an advantage since you've made the determination that education is an important criteria in your home search.
Many people will look at school ranking, MCAS scores, etc. in choosing a school. While those indicators are important and may weigh heavily in one's decision, Cambridge and Somerville are both unique cities and judging the schools based on these metrics alone is not sufficient to make a educated decision. With both Somerville and Cambridge offering parents the option to choose the school they would like their child to attend, visiting the schools is essential in making an informed decision. Both Somerville and Cambridge public school administrations strive to match every child with their top choice, and tend to be quite successful in that.
I have children who have attending Somerville schools. I was overall pleased with my experience and met many great families and teachers there. Somerville has investing much in their schools, with many newer school buildings in more recent years, including the Capuano Early Childhood Center which focuses on the youngest of children, Pre-school and Kindergarten.
Cambridge Public Schools
Somerville Public Schools
As an alternative to public school, Cambridge and Somerville residents can consider enrolling their children in charter school at Prospect Hill Academy.
If you would like to discuss schools in more detail, please feel free to contact me.
According to the Boston.com school ranking report Cambridge ranked 25th and Somerville 118th out of 135. Criteria was based on some stats such as classroom size and student expenditure as well as achievement ranking.
While stats and ranking can give you a good indication, nothing beats visiting the schools and seeing what you are comfortable with. Also it talking to educators over the years, it is important to be in a school system where your child fits in. If yo buy the cheapest house in Cambridge just to be in the school system your child will suffer from a social standpoint making it far mor difficult to thrive.
There are many factors and of course some of it can be personal. Great schools.net is a good resource.