The bill is however facing an uncertain future with Governor Jerry Brown, a former Jesuit seminarian who has not said whether or not he will sign it.
Senators approved the bill on a 23-14 vote after an emotional debate on the final day of the legislative session. The bill was passed earlier this week in the state's House of Representatives.
One of the bill's co-authors, Senator Lois Wolk said the bill seeks to "eliminate the needless pain and the long suffering of those who are dying," even as opponents said the measure could prompt premature suicides.
The R-Rosevelle Senator, Ted Gaines said: "I'm not going to push the old or the weak out of this world, and I think that could be the unintended consequence of this legislation."
The measure to allow doctors to prescribe life-ending medication succeeded on its second attempt after the heavily publicized case of Brittany Maynard. The 29-year-old California woman with brain cancer moved to Oregon to legally take her life.
Her relatives watched in tears the debate from the Senate floor, while supporters lined the Senate balcony.
A previous version passed the Senate but stalled in the Assembly until lawmakers there took it up in a special legislative session. The move to bypass the usual process drew criticism from the governor.
The revised measure includes requirements that the patient be physically capable of taking the medication themselves, that two doctors approve it, that the patient submit several written requests, and that there be two witnesses.
Doctors in Oregon, Washington, Vermont and Montana already can prescribe life-ending drugs.