Getty

Denise Richards just scored a big legal win over her estranged husband Aaron Phypers ... because she's getting court-ordered protection from him after accusing him of domestic violence.

A judge on Friday reportedly granted Denise's request for a restraining order against Aaron, and the ruling bars Aaron from blabbing to the media about Denise or owning guns ... TMZ has confirmed. Play video content

The restraining order will remain in place for 5 years ... and Aaron can't contact Denise, disturb her peace or abuse her.

Denise's lawyer, Josh Reitzas , tells TMZ ... “Justice was served today. Judge Juhas reached the right decision. Ms. Richards has shown remarkable courage, not only in surviving abuse, but in maintaining her dignity amid an ongoing campaign of false

See Full Page