Darren Porter-Harris, 39, was visiting an inmate at HMP Peterborough in November 2019 when he attempted to smuggle in some class C drugs.
Prison officers searched Porter-Harris and found Pregabalin, a prescription drug, and was arrested.
Porter-Harris, of The Boundary, Bedford appeared at Cambridge Crown Court where he was sentenced to four months in prison after previously pleading guilty to bringing a prohibited article into prison.
Detective Sergeant Peter Hume said: “Porter-Harris was clearly trying to sneak drugs into HMP Peterborough for someone else to sell but was caught red-handed. Those caught smuggling drugs will be arrested and put before the courts.”