The film begins in a small village named Ramgarh, which is home to ex-policeman Thakur Baldev Singh (Sanjeev Kumar). He summons an old colleague and requests him to track down a pair of small-time thieves he had once apprehended in the line of duty. Though the two petty criminals Veeru (Dharmendra) and Jaidev (Amitabh Bachchan) are notorious, the Thakur feels that they would be the ideal men to help him end the tyranny of Gabbar Singh (Amjad Khan), an infamous dacoit wanted by the authorities for a 50,000 reward.
After scenes show how the three fought together during a train robbery attempt, and how the criminals often get in and out of jail, and often settle their differences with a coin toss, Veeru and Jai are found and brought to Ramgarh. They are told by the Thakur that they are to hand over Gabbar alive to him for 20,000, plus the 50,000 reward.
Three of Gabbar's enforcers arrive in Ramgarh to collect supplies from the defenseless villagers, but they go back empty-handed due to Veeru and Jai's intervention. In Gabba's camp, the tyrant interrogates the three about why they were defeated by only two men. His psychotic nature is shown when he subjects his men to a game of Russian roulette, but eventually they are shot dead.
Gabbar attacks Ramgarh during Holi, and in a tough battle, Veeru and Jai meet their match and are held at gunpoint. With his two recruits facing death, Thakur has a chance to throw a gun to Veeru. Instead of helping, he stands watching. With quick thinking, Veeru and Jai manage to save their lives. They then state their intentions to leave the villagers to defend themselves, due to the Thakur's cowardice. Before they can leave, Thakur tells them the real reason of why he wants Gabbar, and why he could not help them. Some time ago, Thakur had caught Gabbar and had him imprisoned only for him to escape and plot an evil revenge. Gabbar made his way to the Thakur's home and killed most of his family. The only person to survive this massacre was Thakur's younger daughter-in-law, Radha (Jaya Bhaduri). Thakur tracked down Gabbar, but this time the tyrant held the upper hand due to his gang, and cut off both of Thakur's arms. Thakur had hidden this disability from Veeru and Jai, but now it was clear why he could not physically help them in the first place. Feeling sorry for Thakur, Veeru and Jai decided to forget the reward, though Jai swore on his word to Thakur that he and Veeru will bring Gabbar alive as promised.
Living in Ramgarh, the cynical young Jai and lively Veeru find themselves growing fond of the villagers, especially two girls. Veeru is attracted to Basanti (Hema Malini), a feisty, talkative young woman who makes her living by driving a horse-cart. Jai is drawn to Radha, Thakur's reclusive widowed daughter-in-law, who returns his affections but not overtly.
Basanti and Veeru are captured and Jai follows. The three escape, but Jai is wounded by a gunshot, and with the bandits still following, they hide behind a rock at the foot of a bridge, due to shortage of ammunition. Jai orders Veeru to go back to the village with Basanti, and then return with some ammunition. Veeru, even though unaware of Jai's wound, hesitates, insisting that Jai return to the village instead, upon which Jai suggests that they resolve the matter by tossing a coin. The toss, as always seems to happen, is in Jai's favor, and Veeru heads back to the village with Basanti. Jai, slowly dying with only a few bullets remaining, manages to fend off advances by the bandits, and kills most of Gabbar's men. After failing in most of their advances (and unaware that Jai is alone), in one last attempt, the bandits throw a stick of dynamite, which lands on the bridge near him. Realizing he has only one bullet remaining, Jai blasts the bomb with that last shot from close range (to ensure accuracy), so that the bridge blows up and the dacoits are unable to enter the village and catch Veeru before he could return safely. In the process, he sacrifices his own life for his friend's safety. Veeru returns to find Jai dying, and immediately wants to take him back, but Jai refuses. He sadly says on missing Veeru's marriage, and telling stories to Basanti's and Veeru's children. Some of the villagers rush to the scene, including Radha, who once again has to endure the anguish of losing someone. Veeru then notices Jai's coin lying on the ground, and, upon examination, discovers that both sides of the coin are same, and realizes that Jai has sacrificed his life for him and had cheated him on every coin toss, including the one that resulted in his demise.
Veeru goes after Gabbar in a rage. He catches Gabbar, and almost beats him to death, when the Thakur appears and reminds Veeru of the promise to hand over Gabbar to him alive. Veeru is thinking about breaking the promise and killing Gabbar, when he is reminded that the promise was made by Jai and not him. Veeru tells Thakur that the only reason for him doing so was because it was Jai who made the promise, and leaves. Thakur then advances towards Gabbar, revealing spike-soled shoes, intended to torture and kill Gabbar who begs for life. Thakur severely assaults Gabbbar, destroying his hands, and finally pushing him to a post with protruding spikes, and achieving his vengeance(The Director's Cut Version).
The film ends with Veeru, after Jai's funeral, leaving on a train. However, as he boards, he sees Basanti in one of the seats. As they embrace, the train steams off, with Thakur watching.
(In the alternate ending in the Censor Board's version of film where Gabbar actually survives as police intervene in time, stopping Thakur before he kills Gabbar. This ending was filmed due to pressure from the Central Board Of Film Certification, because they thought that the original ending is too violent for Indian audiences and it will inspire common citizens to take law in their own hands. The DVD versions of the film contain the director's cut of the film, with the originally filmed ending.