Bernadette Smith's infatuation with Gary Ralston, who has waived his right to anonymity, cost the teacher her job and her reputation, Stirling Sheriff Court heard - but there was no suggestion Mr Ralston had suffered long-term harm.
Sheriff Wyllie Robertson told Smith, 35, who kissed the teenager and lay beside him wearing only jeans and a bra, she had committed a serious abuse of trust, and only the fact she had not gone further had saved her from a jail sentence.
Smith, of Denny, Stirlingshire, pled guilty to engaging in sexual activity towards a pupil while in a position of trust, between last September 13 and 20 at the boy's house in Cowie, Stirlingshire, and at Callendar Park, Falkirk.
The former Bannockburn High teacher was placed under supervision for two years as part of a Community Payback Order. She will remain on the Sex Offenders' Register for the same period.
After reading background reports, Sheriff Robertson said her conduct was towards the lesser end of the scale for sex offences covered by the type of charge to which she had pled guilty.
He added: "Some of course may say that had it not been detected it could have led to more serious activity towards the other end of the scale, but that is speculation.
"It is serious enough, of course, when a teacher admits this kind of conduct towards a pupil. We expect teachers to ensure children under their care are safe from abuse, and that has not happened."
Sheriff Robertson told Smith it may have been that "difficulties within your marriage contributed to this aberration", but he said many other teachers coped with marriage difficulties without resorting to what he called "this frankly bizarre course of behaviour".
He told the mother of three: "You have lost your reputation, your job and your career, and your marriage is at an end. You have caused distress to your immediate family, and with the media attention this case has attracted, I suspect your humiliation is complete."
Sheriff Robertson said it was to Smith's credit that she had not sought to blame her victim for what happened, and she was assessed as at very low risk of re-offending.
He added: "I have no material before me that suggests there is any long-standing adverse impact on the victim.
"Nothwithstanding the breach of trust and gravity, it is not necessary to impose a prison sentence for this offence. But let me make it absolutely clear, however, that it would not have taken your conduct to have gone much further for a prison sentence to be inevitable."
He ordered her to return to court on November 12 for a supervision order review.
Before the case was adjourned for reports, the court heard Smith told police and colleagues she was "in love" with Gary, whom she had taught and also given after-school tuition.
Her solicitor, Andrew Gibb, said Smith was currently suspended by the General Teaching Council For Scotland and would be struck off at a hearing in a few weeks.
After Smith pled guilty, Mr Ralston said he did not know how the affair had happened, but said that before it, she was always his favourite teacher. He said: "I was thinking I was quite lucky. A lot of the boys fancied her. I couldn't believe she was with me."