Nickelodeon star Miranda Cosgrove can sleep easier ... the man accused of violating his restraining order and following her to Disneyland pled no contest to felony stalking ... TMZ has learned.
Joshua Stockton was given 3 years probation and will be required to complete a 1 year treatment program, including extensive psychiatric counseling.
As we first reported ... Stockton was ordered in October to stay 100 yards away -- but got busted in February for creeping around Miranda while she was at Disneyland.
In addition to probation and treatment ... Stockton must stay away from Miranda for 10 years. If he fails to comply this time -- he'll almost certainly serve a prison sentence.