According to the Regulations on Housing Provident Fund Management, the longest term of provident fund loans is 30 years, and the lender shall not be over 65 years old when the loan expires. Therefore, at the age of 40, you can still borrow provident fund, and the longest loan period is 25 years.
The actual loan term also needs to be comprehensively considered according to the lender's age, repayment ability, house price and other factors. The older the lender, the shorter the loan period. In addition, the lender also needs to meet certain repayment ability requirements in order to obtain a longer loan term.