Jafar's lamp was a black oil lamp that appeared at the end of Aladdin. It was created following Jafar's wish to become an all-powerful genie, not realizing such a wish would result in eternal imprisonment. It serves as his prison and anchor and should it be destroyed, so too will him.
At the end of the film, Aladdin, tricks Jafar into wishing he was an all-powerful genie. Aladdin, knowing he would be sealed into a lamp for eternity to do a master's bidding, holds up his black, would-be prison that appears once the wish is granted by Genie and it swallows him (while pulling Iago with him) inside the itty bitty space where they start fighting. Genie then sends it far into the Cave of Wonders for 10,000 years.
In the sequel, Iago somehow manages to escape from the Cave of Wonders and then the lamp. But instead of releasing Jafar from it too, he throws it down a nearby well, due to him having grown irritated that Jafar doesn't grant him credit when it's due, and instead uses him (with Jafar also making the grave mistake of reminding him by shouting "Polly Want a Cracker" that finalizes his decision).
Later, Abis Mal finds the lamp at the well and rubs it, releasing Jafar. At the end of the film, Aladdin and his friends tried to capture Jafar's lamp so they could destroy it, which would thus destroy Jafar. In the end, a wounded Iago, having fully turned against Jafar, kicks the lamp into a lava pit and it melts away, causing Jafar to electrocute, then implode into nothingness, destroying him.
The lamp (either Genie's or Jafar's) makes a cameo in the ride Star Tours: The Adventures Continue. Upon finding it in the luggage, G2-9T will state that the Star Tours' non-smoking policy extends to luggage as well.
Though technically a villainous artifact, the lamp is not used for evil purposes and even stymies them, as it keeps Jafar bound and imprisoned.