It pays to prosecute crime.

A former longtime top aide in the Queens District Attorney’s Office was entitled to receive a maximum pension of $319,494, according to a new report from the Empire Center for Public Policy.

Eileen Sullivan, 67, served as executive assistant DA to the late Queens DA Richard Brown and retired in ­August 2017.

Sullivan has since returned to work at the DA’s office part-time while collecting her pension to help on special projects and personnel and budget issues, said an office spokeswoman.

But the spokesperson said the $319,494 figure cited in the report was “inaccurate” and “substantially more” than the pension that Sullivan receives — but did not say what it was.

Sullivan worked for 42 years in city and state government, including over 30 years in the DA’s office. She was in a more generous pension plan because she was hired before 1978 and she made more contributions toward her pension than required, the spokesperson said.

A total of 1,108 retirees in the NYC Employees Retirement System were eligible for pensions of at least $100,000 last year.