In the education sector, corruption is a major problem in large parts of Africa, Asia and South-America. Teachers often accept bribes from students who receive diplomas without serious effort. Students face a social dilemma: from the individual’s perspective, it is attractive to offer a bribe. If all students offer a bribe however, the diploma becomes worthless. In this paper, we model the interaction between teachers and students and study two mechanisms to fight corruption in the education sector. A mechanism that is often used in practice is to enhance teachers’ salaries. According to the fair salary hypothesis, teachers’ bribery requests should diminish when they are paid a decent salary. As an alternative mechanism, we consider the possibility of offering teachers a piece rate based on the number of students attending their classroom. In this mechanism, teachers compete for students who vote with their feet. We test the predictions of the model in a lab experiment in Colombia, a country that is known to suffer from corruption. In agreement with the model, we observe a lot of corruption in the baseline without a mechanism. Introducing fair salaries to the teachers does not help diminishing their requests for corruption. Instead, introducing a piece rate substantially diminishes but does not eliminate requests for bribes. Our results show that by creating a market for honesty, the quality of education and students’ welfare improve substantially.