The forward had been linked to a move back to Brazil, but the Spanish club revealed on Wednesday that they have agreed a deal with Diego Aguirre's team
The 28-year-old had previously been linked with a move back to first club Internacional after making it clear that he would not stay with the Yellow Submarine following their relegation to the Segunda Division.
It was Al Rayyan, however, who announced an agreement with the former Lyon and Corinthians man on Tuesday.
Following that announcement, Villarreal released a short statement on their official website confirming that the South American would not be staying in Spain for the 2012-13 season.
"Villarreal and Al Rayyan have come to an agreement for the transfer of Brazilian striker Nilmar Honorato da Silva, who will play the next season in the Arab club," the missive reads, bringing to an end the star's three-year spell with the institution.
Nilmar, who will sign a four-year deal with the Qataris, played a total of 116 times for Villarreal, scoring 34 goals in all competitions.