Short answer. Usually no. Rent a subtenant paid in advance generally does not count against the landlord's claim. Article 1652 says such advance payments shall be deemed not to have been made, so far as the lessor's claim is concerned, unless they were made under the custom of the place.
What the law says
Payments of rent in advance by the sublessee shall be deemed not to have been made, so far as the lessor's claim is concerned, unless said payments were effected in virtue of the custom of the place.
Civil Code, Article 1652 — The Sublessee's Liability to the Owner. Read the full provision →
Advance rent does not shield the subtenant
Article 1652 makes the sublessee subsidiarily liable to the lessor for rent the lessee owes. A subtenant who has already paid his own rent in advance to the middle tenant may think this settles his exposure. It generally does not. The article provides that payments of rent in advance by the sublessee shall be deemed not to have been made, so far as the lessor's claim is concerned. In the eyes of the owner pursuing unpaid rent, those early payments are treated as if they never happened, so the subtenant can still be called on despite having paid the sublessor ahead of time.
Why the law disregards prepayment
The rule guards the owner against a simple evasion. If a lessee in danger of defaulting could collect rent far in advance from his subtenant, the money might disappear before it ever reaches the owner, leaving the lessor unpaid while the subtenant claims to have already settled. By disregarding advance payments as against the lessor's claim, Article 1652 stops the lessee and sublessee from arranging prepayment in a way that defeats the owner's subsidiary remedy. The subtenant's payment to the sublessor is valid between them, but it does not bind or bar the owner.
The limits of the subtenant's liability
The subsidiary liability is not unlimited. Article 1652 says the sublessee is not responsible beyond the amount of rent due from him, under the terms of the sublease, at the time of the lessor's extrajudicial demand. So the owner's reach is measured by what the subtenant still owes on his own sublease when demand is made — not by the whole of the lessee's debt. And the liability is subsidiary, meaning it is the lessee who is primarily answerable; the subtenant is pursued for what the arrangement leaves him owing at the moment of demand.
The custom-of-the-place exception
There is one opening for the subtenant. Advance payments do count against the lessor's claim if they were effected in virtue of the custom of the place — that is, where paying rent ahead is the accepted, ordinary practice in that locality. Where such a custom genuinely exists and the prepayment followed it, the subtenant may credit those payments even against the owner. A subtenant relying on this exception should be ready to show that the local custom exists and that his advance payment truly conformed to it, since the general rule otherwise disregards prepayment.